Teach ScalarEvolution to sharpen range information.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 15 Oct 2014 19:25:28 +0000 (19:25 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 15 Oct 2014 19:25:28 +0000 (19:25 +0000)
commit40edbf130e283785030fdc4a3034f7372a9f0854
tree32cebff5119170783121a45e0c1d644735406627
parentf0f7ec31d46a43138f332ab3258c8d00c70e00ad
Teach ScalarEvolution to sharpen range information.

If x is known to have the range [a, b) in a loop predicated by (icmp
ne x, a), its range can be sharpened to [a + 1, b).  Get
ScalarEvolution and hence IndVars to exploit this fact.

This change triggers an optimization to widen-loop-comp.ll, so it had
to be edited to get it to pass.

phabricator: http://reviews.llvm.org/D5639

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219834 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Transforms/IndVarSimplify/sharpen-range-metadata.ll [new file with mode: 0644]
test/Transforms/IndVarSimplify/widen-loop-comp.ll