This is an archive of the discontinued LLVM Phabricator instance.

Improve __builtin_constant_p lowering
ClosedPublic

Authored by joerg on Sep 16 2019, 3:13 PM.

Details

Summary

__builtin_constant_p used to be short-cut evaluated to false when building with -O0. This is undesirable as it means that constant folding in the front-end can give different results than folding in the back-end. It can also create conditional branches on constant conditions that don't get folded away. With the improvements to the llvm.is.constant handling on the LLVM side, the short-cut is no longer useful.

Adjust various codegen tests to not depend on the optimizations.

Diff Detail

Event Timeline

joerg created this revision.Sep 16 2019, 3:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2019, 3:13 PM
Herald added a subscriber: wuzish. · View Herald Transcript
rsmith accepted this revision.Sep 21 2019, 10:07 AM

OK, this is fine by me if you're confident this doesn't degrade the generated code at -O0.

This revision is now accepted and ready to land.Sep 21 2019, 10:07 AM
This revision was automatically updated to reflect the committed changes.