This is an archive of the discontinued LLVM Phabricator instance.

[CGP] Fix handling of null pointer values in optimizeMemoryInst
ClosedPublic

Authored by john.brawn on Nov 24 2017, 10:17 AM.

Details

Summary

The current way that trivial addressing modes are detected incorrectly thinks that null pointers are non-trivial, leading to an infinite loop where we keep duplicating the same select. Fix this by being aware of null when deciding if an addressing mode is trivial.

Diff Detail

Repository
rL LLVM

Event Timeline

john.brawn created this revision.Nov 24 2017, 10:17 AM
skatkov accepted this revision.Nov 26 2017, 8:40 PM

Agreed. I also came up to the same case (null is not considered as non-trivial) however not sure it is a cause of hangs-up due to select is off by default in LLVM trunk at this moment. But probably we have the same issue with Phi.

There is also one issue related to initialMap due to it seems it is possible that two bases can have different types but we crash with assert in this case... Will try to come up with a patch today.

This revision is now accepted and ready to land.Nov 26 2017, 8:40 PM
This revision was automatically updated to reflect the committed changes.