[llvm-commits] [llvm] r141219 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Andrew Trick atrick at apple.com
Wed Oct 5 15:06:54 PDT 2011


Author: atrick
Date: Wed Oct  5 17:06:53 2011
New Revision: 141219

URL: http://llvm.org/viewvc/llvm-project?rev=141219&view=rev
Log:
Fixes PR11070 - assert in SCEV getConstantEvolvingPHIOperands.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=141219&r1=141218&r2=141219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Oct  5 17:06:53 2011
@@ -4705,23 +4705,17 @@
     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;





More information about the llvm-commits mailing list