diff options
author | Andrew Trick <atrick@apple.com> | 2011-10-05 22:06:53 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2011-10-05 22:06:53 +0000 |
commit | 3e8a576da14204861ac9b5593d100041ced8cc20 (patch) | |
tree | 53e2ebc1b39909f59d08cb62b34f299a721ea677 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | db1633530a838896ca580d5fb97ba9c11a64c5e2 (diff) | |
download | bcm5719-llvm-3e8a576da14204861ac9b5593d100041ced8cc20.tar.gz bcm5719-llvm-3e8a576da14204861ac9b5593d100041ced8cc20.zip |
Fixes PR11070 - assert in SCEV getConstantEvolvingPHIOperands.
llvm-svn: 141219
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index ff9eaa59c75..f09f357c61c 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -4705,23 +4705,17 @@ getConstantEvolvingPHIOperands(Instruction *UseInst, const Loop *L, if (!OpInst || !canConstantEvolve(OpInst, L)) return 0; PHINode *P = dyn_cast<PHINode>(OpInst); - if (P) { - if (PHI && PHI != P) return 0; // Evolving from multiple different PHIs. - PHI = P; - continue; - } - - // If this operand is already visited, reuse the prior result. - P = PHIMap.lookup(OpInst); - if (P) { - assert((!PHI || P == PHI) && "inconsistent data flow"); - PHI = P; - continue; + if (!P) + // If this operand is already visited, reuse the prior result. + // We may have P != PHI if this is the deepest point at which the + // inconsistent paths meet. + P = PHIMap.lookup(OpInst); + if (!P) { + // Recurse and memoize the results, whether a phi is found or not. + // This recursive call invalidates pointers into PHIMap. + P = getConstantEvolvingPHIOperands(OpInst, L, PHIMap); + PHIMap[OpInst] = P; } - // Recurse and memoize the results, whether a phi is found or not. - // This recursive call invalidates pointers into PHIMap. - P = getConstantEvolvingPHIOperands(OpInst, L, PHIMap); - PHIMap[OpInst] = P; if (P == 0) return 0; // Not evolving from PHI if (PHI && PHI != P) return 0; // Evolving from multiple different PHIs. PHI = P; |