Undo Chris' last patch, it caused a regression.
authorReid Spencer <rspencer@reidspencer.com>
Mon, 16 Oct 2006 23:08:08 +0000 (23:08 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 16 Oct 2006 23:08:08 +0000 (23:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30991 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 6654daff37d0f3ac5d805a0d905898565ccb456d..f0961de52743d90547eb64b842764213670b71a4 100644 (file)
@@ -1970,10 +1970,10 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
         return BinaryOperator::createAnd(Op0, NewNot);
       }
 
-      // -(X sdiv C)  -> (X sdiv -C)
+      // 0 - (X sdiv C)  -> (X sdiv -C)
       if (Op1I->getOpcode() == Instruction::Div)
         if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(Op0))
-          if (!CSI->isNullValue())
+          if (CSI->isNullValue())
             if (Constant *DivRHS = dyn_cast<Constant>(Op1I->getOperand(1)))
               return BinaryOperator::createDiv(Op1I->getOperand(0),
                                                ConstantExpr::getNeg(DivRHS));