diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2017-12-14 14:47:52 +0000 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2017-12-14 14:47:52 +0000 |
commit | 33c9d5535f4c2d93130825ad5428cf15e53657ed (patch) | |
tree | de000f76a0610d4ef6d82398ca6abdbd94cb01d1 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | 3739e14ab47173de5f8e1674b90557c884c59824 (diff) | |
download | bcm5719-llvm-33c9d5535f4c2d93130825ad5428cf15e53657ed.tar.gz bcm5719-llvm-33c9d5535f4c2d93130825ad5428cf15e53657ed.zip |
[ScalarEvolution] Fix base condition in isNormalAddRecPHI.
Summary:
The function is meant to recurse until it comes upon the
phi it's looking for. However, with the current condition,
it will recurse until it finds anything _but_ the phi.
The function will even fail for simple cases like:
%i = phi i32 [ %inc, %loop ], ...
...
%inc = add i32 %i, 1
because the base condition will not happen when the phi
is recursed to, and the recursion will end with a 'false'
result since the previous instruction is a phi.
Reviewers: sanjoy, atrick
Reviewed By: sanjoy
Subscribers: Ka-Ka, bjope, llvm-commits
Committing on behalf of: Bevin Hansson (bevinh)
Differential Revision: https://reviews.llvm.org/D40946
llvm-svn: 320700
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index b2bdb5538e5..0caff18264d 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -878,7 +878,7 @@ bool SCEVExpander::isNormalAddRecExprPHI(PHINode *PN, Instruction *IncV, if (IncV->mayHaveSideEffects()) return false; - if (IncV != PN) + if (IncV == PN) return true; return isNormalAddRecExprPHI(PN, IncV, L); |