Don't rebuild RHSNeg. Just use the one that's already there.
authorBill Wendling <isanbard@gmail.com>
Mon, 1 Dec 2008 21:06:30 +0000 (21:06 +0000)
committerBill Wendling <isanbard@gmail.com>
Mon, 1 Dec 2008 21:06:30 +0000 (21:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60370 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 9ee375c382550f1b59d695b226b9be0f9cf0c822..8d7616053b1d6b0ce6352ea8a8e4b4e09b43b1df 100644 (file)
@@ -2937,8 +2937,7 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
         if (RHS != RHSNeg) {    // Check that there is no overflow.
           Constant *CINeg = ConstantExpr::getNeg(CI);
           if (CI != CINeg)      // Check that there is no overflow.
-            return BinaryOperator::CreateSDiv(LHSNeg,
-                                              ConstantExpr::getNeg(RHS));
+            return BinaryOperator::CreateSDiv(LHSNeg, RHSNeg);
         }
       }
     }