indvars: LinearFunctionTestReplace for non-canonical IVs.
authorAndrew Trick <atrick@apple.com>
Mon, 18 Jul 2011 20:32:31 +0000 (20:32 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 18 Jul 2011 20:32:31 +0000 (20:32 +0000)
commitfc933c073e9357a791c0f6b307355ed735e3557f
tree81712653234f4b198036ba213a2433481232a702
parenta921164f39d8bb035325db3564b8f2a6acc053dc
indvars: LinearFunctionTestReplace for non-canonical IVs.

For -disable-iv-rewrite, perform LFTR without generating a new
"canonical" induction variable. Instead find the "best" existing
induction variable for use in the loop exit test and compute the final
value of that IV for use in the new loop exit test. In short,
convert to a simple eq/ne exit test as long as it's cheap to do so.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135420 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/ada-loops.ll
test/Transforms/IndVarSimplify/lftr-reuse.ll [new file with mode: 0644]