OSDN Git Service

Made SCEV's UDiv expressions more canonical. When dividing a
authorAndrew Trick <atrick@apple.com>
Sat, 6 Aug 2011 07:00:37 +0000 (07:00 +0000)
committerAndrew Trick <atrick@apple.com>
Sat, 6 Aug 2011 07:00:37 +0000 (07:00 +0000)
commit06988bcf6a5c74e81cf7e76f06a686aa822ec00a
treeff0b2f17005dae608bc8820f0a33b32e716d77d0
parentccfa446450c9e3e0b3591343c4c5bea1e4cdc043
Made SCEV's UDiv expressions more canonical. When dividing a
recurrence, the initial values low bits can sometimes be ignored.

To take advantage of this, added FoldIVUser to IndVarSimplify to fold
an IV operand into a udiv/lshr if the operator doesn't affect the
result.

-indvars -disable-iv-rewrite now transforms

i = phi i4
i1 = i0 + 1
idx = i1 >> (2 or more)
i4 = i + 4

into

i = phi i4
idx = i0 >> ...
i4 = i + 4

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137013 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/iv-fold.ll [new file with mode: 0644]