[llvm-commits] [llvm] r41169 - /llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp

Nick Lewycky nicholas at mxc.ca
Sat Aug 18 16:18:04 PDT 2007


Author: nicholas
Date: Sat Aug 18 18:18:03 2007
New Revision: 41169

URL: http://llvm.org/viewvc/llvm-project?rev=41169&view=rev
Log:
Never insert duplicate edges.

Modified:
    llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=41169&r1=41168&r2=41169&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Sat Aug 18 18:18:03 2007
@@ -711,23 +711,27 @@
           ++J;
         }
 
-        if (J != E && J->To == n && J->Subtree->dominates(Subtree)) {
+        if (J != E && J->To == n) {
+          assert(J->Subtree->dominates(Subtree));
+
           edge.LV = static_cast<LatticeVal>(J->LV & R);
           assert(validPredicate(edge.LV) && "Invalid union of lattice values.");
-          if (edge.LV != J->LV) {
 
-            // We have to tighten any edge beneath our update.
-            for (iterator K = I; K->To == n; --K) {
-              if (K->Subtree->DominatedBy(Subtree)) {
-                LatticeVal LV = static_cast<LatticeVal>(K->LV & edge.LV);
-                assert(validPredicate(LV) && "Invalid union of lattice values");
-                K->LV = LV;
-              }
-              if (K == B) break;
+          if (edge.LV == J->LV)
+            return; // This update adds nothing new.
+	}
+
+        if (I != B) {
+          // We also have to tighten any edge beneath our update.
+          for (iterator K = I - 1; K->To == n; --K) {
+            if (K->Subtree->DominatedBy(Subtree)) {
+              LatticeVal LV = static_cast<LatticeVal>(K->LV & edge.LV);
+              assert(validPredicate(LV) && "Invalid union of lattice values");
+              K->LV = LV;
             }
-
+            if (K == B) break;
           }
-        }
+	}
 
         // Insert new edge at Subtree if it isn't already there.
         if (I == E || I->To != n || Subtree != I->Subtree)





More information about the llvm-commits mailing list