This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Make isImpliedCond smarter.
ClosedPublic

Authored by sanjoy on Mar 15 2015, 2:25 AM.

Details

Summary

This change teaches isImpliedCond to infer things like "X sgt 0" => "X -
1 sgt -1".

The logic to do the heavy lifting is present in the ConstantRange
class, this change simply gets ScalarEvolution to exploit that when
reasonable.

Depends on D8345

Diff Detail

Repository
rL LLVM

Event Timeline

sanjoy updated this revision to Diff 21995.Mar 15 2015, 2:25 AM
sanjoy retitled this revision from to [SCEV] Make isImpliedCond smarter..
sanjoy updated this object.
sanjoy edited the test plan for this revision. (Show Details)
sanjoy added a reviewer: atrick.
sanjoy added a subscriber: Unknown Object (MLST).
atrick edited edge metadata.Mar 16 2015, 9:26 AM

Hi Sanjoy,

This looks ok, but is there any way to canonicalize (add-by-constant <pred> constant) before checking isImpliedCond? That way it would be symmetric and you wouldn't need separate logic to handle it.

atrick accepted this revision.Mar 16 2015, 11:41 AM
atrick edited edge metadata.

Yep. I don't have a better suggestion then.
LGTM.

This revision is now accepted and ready to land.Mar 16 2015, 11:41 AM
This revision was automatically updated to reflect the committed changes.