This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] eliminate switch cases based on known range of switch condition
ClosedPublic

Authored by spatel on May 15 2016, 11:58 AM.

Details

Summary

This was noted in PR24766:
https://llvm.org/bugs/show_bug.cgi?id=24766#c2

We may not know whether the sign bit(s) are zero or one, but we can still optimize based on knowing that the sign bit is repeated.

Diff Detail

Event Timeline

spatel updated this revision to Diff 57302.May 15 2016, 11:58 AM
spatel retitled this revision from to [SimplifyCFG] eliminate switch cases based on known range of switch condition.
spatel updated this object.
spatel added reviewers: majnemer, davidxl, hfinkel.
spatel added a subscriber: llvm-commits.
davidxl added inline comments.May 19 2016, 10:44 AM
lib/Transforms/Utils/SimplifyCFG.cpp
3921

MinCondWidth --> MaxCondWidth?

spatel added inline comments.May 19 2016, 12:19 PM
lib/Transforms/Utils/SimplifyCFG.cpp
3921

Yes, that's vague. How about "MaxSignificantBitsInCond"?

spatel updated this revision to Diff 57856.May 19 2016, 1:56 PM

Patch updated:
Changed variable name to be less ambiguous.

davidxl accepted this revision.May 19 2016, 9:30 PM
davidxl edited edge metadata.

lgtm

This revision is now accepted and ready to land.May 19 2016, 9:30 PM
This revision was automatically updated to reflect the committed changes.