Fix PR25372 - teach replaceCongruentPHIs to handle cases where SE evaluates a PHI...
authorSilviu Baranga <silviu.baranga@arm.com>
Tue, 3 Nov 2015 16:27:04 +0000 (16:27 +0000)
committerSilviu Baranga <silviu.baranga@arm.com>
Tue, 3 Nov 2015 16:27:04 +0000 (16:27 +0000)
commit94652aba1f177e8080b87fb997fa2da4602b45a0
tree57413cd5faa8fcfd218d111509aa5fe6f2436646
parent1b023a319e335592bebee48c585858793db87c35
Fix PR25372 - teach replaceCongruentPHIs to handle cases where SE evaluates a PHI to a SCEVConstant

Summary:
Since now Scalar Evolution can create non-add rec expressions for PHI
nodes, it can also create SCEVConstant expressions. This will confuse
replaceCongruentPHIs, which previously relied on the fact that SCEV
could not produce constants in this case.

We will now replace the node with a constant in these cases - or avoid
processing the Phi in case of a type mismatch.

Reviewers: sanjoy

Subscribers: llvm-commits, majnemer

Differential Revision: http://reviews.llvm.org/D14230

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