Fix some bugs in an xform added yesterday. This fixes Prolangs-C/allroots.
authorChris Lattner <sabre@nondot.org>
Fri, 14 Jan 2005 17:35:12 +0000 (17:35 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 14 Jan 2005 17:35:12 +0000 (17:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19553 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 840dbd47d43f01f9a4059abc5dd2b7d7a4cf142e..6d4718d42cacb8338aeff6696dd66e9b96823f02 100644 (file)
@@ -3651,7 +3651,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
                            BinaryOperator::createNeg(SubOp->getOperand(1)), SI);
               }
 
-              Value *NewTrueOp = AddOp->getOperand(1);
+              Value *NewTrueOp = OtherAddOp;
               Value *NewFalseOp = NegVal;
               if (AddOp != TI)
                 std::swap(NewTrueOp, NewFalseOp);
@@ -3659,7 +3659,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
                 new SelectInst(CondVal, NewTrueOp,NewFalseOp,SI.getName()+".p");
                                
               NewSel = InsertNewInstBefore(NewSel, SI);
-              return BinaryOperator::createAdd(AddOp->getOperand(0), NewSel);
+              return BinaryOperator::createAdd(SubOp->getOperand(0), NewSel);
             }
           }
         }