This is an archive of the discontinued LLVM Phabricator instance.

[JumpThreading] Simplify comparisons when simplifying branches
ClosedPublic

Authored by reames on Apr 27 2015, 5:08 PM.

Details

Summary

If we have recognized that a conditional is constant at a particular location in the code (while trying to decide if we can simplify a conditional branch), we can eagerly replace that condition with a constant if it's definition is post dominated by the branch in question.

In practice, this ends up being a compile time savings at most. JumpThreading would have visited each using branch anyways. CVP would have visited the cmp itself again. Unless LVI gives up early, we shouldn't gain any addition power by doing this transformation early. What we do gain is simplicity and compile time.

Diff Detail

Repository
rL LLVM

Event Timeline

reames updated this revision to Diff 24519.Apr 27 2015, 5:08 PM
reames retitled this revision from to [JumpThreading] Simplify comparisons when simplifying branches.
reames updated this object.
reames edited the test plan for this revision. (Show Details)
reames added reviewers: hfinkel, nicholas, apilipenko.
reames added a subscriber: Unknown Object (MLST).
apilipenko accepted this revision.May 6 2015, 6:53 AM
apilipenko edited edge metadata.

LGTM.

This revision is now accepted and ready to land.May 6 2015, 6:53 AM
hfinkel edited edge metadata.May 6 2015, 2:21 PM

LGTM too (without the unrelated white-space change).

In the future, please post patches to phabricator with full context, see: http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface

lib/Transforms/Scalar/JumpThreading.cpp
855 ↗(On Diff #24519)

Unrelated white-space change.

This revision was automatically updated to reflect the committed changes.