Bug 1029830 - IonMonkey: GVN: A goto to a non-dominated block won't benefit from a GVN re-run even if its dominators are updated r=nbp
authorDan Gohman <sunfish@mozilla.com>
Wed, 17 Sep 2014 10:27:25 -0700
changeset 205741 d123ad5677f6be76ba98550876451b743a086de1
parent 205740 b0f729f0e0d38840fcdda9296b62a3d598cc62d0
child 205742 6e9a69bead52911e66eb586184c558259a344caa
push id49264
push userdgohman@mozilla.com
push dateWed, 17 Sep 2014 17:27:46 +0000
treeherdermozilla-inbound@ce0a75f9481b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1029830
milestone35.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 1029830 - IonMonkey: GVN: A goto to a non-dominated block won't benefit from a GVN re-run even if its dominators are updated r=nbp
js/src/jit/ValueNumbering.cpp
--- a/js/src/jit/ValueNumbering.cpp
+++ b/js/src/jit/ValueNumbering.cpp
@@ -199,16 +199,26 @@ ComputeNewDominator(MBasicBlock *block, 
 // whether the block's new dominator will be closer than its old one and whether
 // it will expose potential optimization opportunities.
 static bool
 IsDominatorRefined(MBasicBlock *block)
 {
     MBasicBlock *old = block->immediateDominator();
     MBasicBlock *now = ComputeNewDominator(block, old);
 
+    // If this block is just a goto and it doesn't dominate its destination,
+    // removing its predecessors won't refine the dominators of anything
+    // interesting.
+    MControlInstruction *control = block->lastIns();
+    if (*block->begin() == control && block->phisEmpty() && control->isGoto() &&
+        !block->dominates(control->toGoto()->target()))
+    {
+        return false;
+    }
+
     // We've computed block's new dominator. Test whether there are any
     // newly-dominating definitions which look interesting.
     MOZ_ASSERT(old->dominates(now), "Refined dominator not dominated by old dominator");
     for (MBasicBlock *i = now; i != old; i = i->immediateDominator()) {
         if (!i->phisEmpty() || *i->begin() != i->lastIns())
             return true;
     }