This is an archive of the discontinued LLVM Phabricator instance.

[GuardWidening] Ignore guards with trivial conditions
ClosedPublic

Authored by mkazantsev on Aug 3 2018, 5:28 AM.

Details

Summary

Guard widening should not spend efforts on dealing with guards with trivial true/false conditions.
Such guards can easily be eliminated by any further cleanup pass like instcombine. However we
should not unconditionally delete them because it may be profitable to widen other conditions
into such guards.

Diff Detail

Repository
rL LLVM

Event Timeline

LGTM bar some minor stylistic stuff.

lib/Transforms/Scalar/GuardWidening.cpp
354 ↗(On Diff #158986)

Can we just check that it is constant? Booleans hardly get any values other than True/False...

422 ↗(On Diff #158986)

Uh... that reads somewhat uneasy, as False/True values are way up and I first read them as just bools :)

fedor.sergeev accepted this revision.Aug 3 2018, 5:52 AM
This revision is now accepted and ready to land.Aug 3 2018, 5:52 AM
This revision was automatically updated to reflect the committed changes.