Bug 881397 - Minor dominator-tree computation cleanups. r=sstangl
authorDan Gohman <sunfish@google.com>
Mon, 10 Jun 2013 15:48:10 -0700
changeset 146068 ca991d0bb5eadbc965412d810029880283ab56df
parent 146067 773df082bd35fca7b8ca9f19920f2bd2880659e1
child 146069 6fac977ad9eaea999bd9bb02c7f9de5213251170
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs881397
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 881397 - Minor dominator-tree computation cleanups. r=sstangl
js/src/ion/IonAnalysis.cpp
--- a/js/src/ion/IonAnalysis.cpp
+++ b/js/src/ion/IonAnalysis.cpp
@@ -662,17 +662,17 @@ IntersectDominators(MBasicBlock *block1,
                 return NULL; // Empty intersection.
             finger1 = idom;
         }
 
         while (finger2->id() > finger1->id()) {
             MBasicBlock *idom = finger2->immediateDominator();
             if (idom == finger2)
                 return NULL; // Empty intersection.
-            finger2 = finger2->immediateDominator();
+            finger2 = idom;
         }
     }
     return finger1;
 }
 
 static void
 ComputeImmediateDominators(MIRGraph &graph)
 {
@@ -699,18 +699,20 @@ ComputeImmediateDominators(MIRGraph &gra
             if (block->immediateDominator() == *block)
                 continue;
 
             MBasicBlock *newIdom = block->getPredecessor(0);
 
             // Find the first common dominator.
             for (size_t i = 1; i < block->numPredecessors(); i++) {
                 MBasicBlock *pred = block->getPredecessor(i);
-                if (pred->immediateDominator() != NULL)
-                    newIdom = IntersectDominators(pred, newIdom);
+                if (pred->immediateDominator() == NULL)
+                    continue;
+
+                newIdom = IntersectDominators(pred, newIdom);
 
                 // If there is no common dominator, the block self-dominates.
                 if (newIdom == NULL) {
                     block->setImmediateDominator(*block);
                     changed = true;
                     break;
                 }
             }