summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-10-05 22:06:53 +0000
committerAndrew Trick <atrick@apple.com>2011-10-05 22:06:53 +0000
commitef8a4c2a65fe28e8a798a0631e34356271e5f55f (patch)
tree11baf4004b07b34a2688b5e4397df5a5c5df2152 /lib/Analysis
parent2130ab0131ca0c0f5607937fe1f6ed48c28d39a2 (diff)
downloadllvm-ef8a4c2a65fe28e8a798a0631e34356271e5f55f.tar.gz
llvm-ef8a4c2a65fe28e8a798a0631e34356271e5f55f.tar.bz2
llvm-ef8a4c2a65fe28e8a798a0631e34356271e5f55f.tar.xz
Fixes PR11070 - assert in SCEV getConstantEvolvingPHIOperands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141219 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index ff9eaa59c7..f09f357c61 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/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;