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 205885 d123ad5677f6be76ba98550876451b743a086de1
parent 205884 b0f729f0e0d38840fcdda9296b62a3d598cc62d0
child 205886 6e9a69bead52911e66eb586184c558259a344caa
push id27507
push userryanvm@gmail.com
push dateThu, 18 Sep 2014 02:16:54 +0000
treeherdermozilla-central@488d490da742 [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;
     }