ScalarEvolution: Fix handling of AddRecs in isKnownPredicate
authorJustin Bogner <mail@justinbogner.com>
Fri, 23 May 2014 00:06:56 +0000 (00:06 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 23 May 2014 00:06:56 +0000 (00:06 +0000)
commite318ce611f265b0a1e0bfd6e51cd3cad28324278
tree21bc011654b35658da2abddd9b7a5d54a0fd0b3d
parentc86ebbd01eba02ff04ffb57537e24f2aa7b8795d
ScalarEvolution: Fix handling of AddRecs in isKnownPredicate

ScalarEvolution::isKnownPredicate() can wrongly reduce a comparison
when both the LHS and RHS are SCEVAddRecExprs. This checks that both
LHS and RHS are guarded in the case when both are SCEVAddRecExprs.

The test case is against indvars because I could not find a way to
directly test SCEV.

Patch by Sanjay Patel!

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