Bug 1315640: Split unnecessary loop into linear code; r=nbp
authorBenjamin Bouvier <benj@benj.me>
Mon, 07 Nov 2016 11:35:30 +0100
changeset 321402 750b9537efcd6b082dbd0f1e6913df0f007af1dc
parent 321401 09ac8e800a9da779d246fb84e1eb79692f217966
child 321403 c45f2ebe0e66c30eae64ccec2c8834367187217b
push id30927
push userphilringnalda@gmail.com
push dateTue, 08 Nov 2016 04:37:38 +0000
treeherdermozilla-central@f88d94ae4967 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1315640
milestone52.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 1315640: Split unnecessary loop into linear code; r=nbp MozReview-Commit-ID: 9EExrHvQqac
js/src/jit/MIR.cpp
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -2794,21 +2794,20 @@ MBinaryBitwiseInstruction::foldUnnecessa
 {
     if (specialization_ != MIRType::Int32)
         return this;
 
     // Fold unsigned shift right operator when the second operand is zero and
     // the only use is an unsigned modulo. Thus, the expression
     // |(x >>> 0) % y| becomes |x % y|.
     if (isUrsh() && hasOneDefUse() && IsUint32Type(this)) {
-        for (MUseDefIterator use(this); use; use++) {
-            if (use.def()->isMod() && use.def()->toMod()->isUnsigned())
-                return getOperand(0);
-            break;
-        }
+        MUseDefIterator use(this);
+        if (use.def()->isMod() && use.def()->toMod()->isUnsigned())
+            return getOperand(0);
+        MOZ_ASSERT(!(++use));
     }
 
     // Eliminate bitwise operations that are no-ops when used on integer
     // inputs, such as (x | 0).
 
     MDefinition* lhs = getOperand(0);
     MDefinition* rhs = getOperand(1);