Bug 881397 - Minor dominator-tree computation cleanups. r=sstangl
authorDan Gohman <sunfish@google.com>
Mon, 10 Jun 2013 15:48:10 -0700
changeset 134577 ca991d0bb5eadbc965412d810029880283ab56df
parent 134576 773df082bd35fca7b8ca9f19920f2bd2880659e1
child 134578 6fac977ad9eaea999bd9bb02c7f9de5213251170
push id29280
push usersunfish@google.com
push dateMon, 10 Jun 2013 22:50:29 +0000
treeherdermozilla-inbound@ca991d0bb5ea [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;
                 }
             }