Bug 1314438: Follow-up fix to only guard if it isn't a guard already ON CLOSED TREE, r=bustage
☠☠ backed out by e5dfb4395051 ☠ ☠
authorHannes Verschore <hv1989@gmail.com>
Mon, 07 Nov 2016 10:20:56 +0100
changeset 351430 969ad213c9831dbcebd9023a6755a7c59114151d
parent 351429 3cbd085908c8f930656a42a91f64eafb9d37579b
child 351431 bd16c2fde4bfec3766027861d8149ed13e418def
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1314438
milestone52.0a1
Bug 1314438: Follow-up fix to only guard if it isn't a guard already ON CLOSED TREE, r=bustage
js/src/jit/MIR.cpp
js/src/jit/ValueNumbering.cpp
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -2385,17 +2385,18 @@ MPhi::foldsTernary(TempAllocator& alloc)
     {
         return nullptr;
     }
 
     // If testArg is an int32 type we can:
     // - fold testArg ? testArg : 0 to testArg
     // - fold testArg ? 0 : testArg to 0
     if (testArg->type() == MIRType::Int32 && c->numberToDouble() == 0) {
-        testArg->setGuardRangeBailoutsUnchecked();
+        if (DeadIfUnused(testArg))
+            testArg->setGuardRangeBailoutsUnchecked();
 
         // When folding to the constant we need to hoist it.
         if (trueDef == c && !c->block()->dominates(block()))
             c->block()->moveBefore(pred->lastIns(), c);
         return trueDef;
     }
 
     // If testArg is an double type we can:
@@ -4388,17 +4389,18 @@ MCompare::tryFoldEqualOperands(bool* res
                compareType_ == Compare_String || compareType_ == Compare_StrictString ||
                compareType_ == Compare_Object || compareType_ == Compare_Bitwise);
 
     if (isDoubleComparison() || isFloat32Comparison()) {
         if (!operandsAreNeverNaN())
             return false;
     }
 
-    lhs()->setGuardRangeBailoutsUnchecked();
+    if (DeadIfUnused(lhs()))
+        lhs()->setGuardRangeBailoutsUnchecked();
 
     *result = (jsop() == JSOP_STRICTEQ);
     return true;
 }
 
 bool
 MCompare::tryFoldTypeOf(bool* result)
 {
--- a/js/src/jit/ValueNumbering.cpp
+++ b/js/src/jit/ValueNumbering.cpp
@@ -791,18 +791,20 @@ ValueNumberer::visitDefinition(MDefiniti
         MOZ_ASSERT(!sim->isDiscarded());
         ReplaceAllUsesWith(def, sim);
 
         // The node's foldsTo said |def| can be replaced by |rep|. If |def| is a
         // guard, then either |rep| is also a guard, or a guard isn't actually
         // needed, so we can clear |def|'s guard flag and let it be discarded.
         def->setNotGuardUnchecked();
 
-        if (def->isGuardRangeBailouts())
-            sim->setGuardRangeBailoutsUnchecked();
+        if (def->isGuardRangeBailouts()) {
+            if (DeadIfUnused(sim))
+                sim->setGuardRangeBailoutsUnchecked();
+        }
 
         if (DeadIfUnused(def)) {
             if (!discardDefsRecursively(def))
                 return false;
 
             // If that ended up discarding |sim|, then we're done here.
             if (sim->isDiscarded())
                 return true;