[IndVars] Fix a bug in r248045.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Sun, 20 Sep 2015 01:52:18 +0000 (01:52 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Sun, 20 Sep 2015 01:52:18 +0000 (01:52 +0000)
commit8ba782a30cbc855cccafc6b8be6fb16bad12fa67
tree9d8d632677cb7301cc8f51c71df88d8ffafeb673
parentd58f92c07d8c0b6beb9e22b0fbf7feba2517e7b6
[IndVars] Fix a bug in r248045.

Because -indvars widens induction variables through arithmetic,
`NeverNegative` cannot be a property of the `WidenIV` (a `WidenIV`
manages information for all transitive uses of an IV being widened,
including uses of `-1 * IV`).  Instead it must live on `NarrowIVDefUse`
which manages information for a specific def-use edge in the transitive
use list of an induction variable.

This change also adds a test case that demonstrates the problem with
r248045.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248107 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/IndVarSimplify.cpp
test/Transforms/IndVarSimplify/widen-loop-comp.ll