fix an oversight caught by Frits!
authorChris Lattner <sabre@nondot.org>
Sun, 19 Dec 2010 23:24:04 +0000 (23:24 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 19 Dec 2010 23:24:04 +0000 (23:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122204 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstructionCombining.cpp

index 5fa930e7541241f87f4cf632de2727f9a5735da9..c679ef4efa34e3fcf8558fb9587b8b36f228426b 100644 (file)
@@ -1151,9 +1151,10 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
         // If the normal result of the add is dead, and the RHS is a constant,
         // we can transform this into a range comparison.
         // overflow = uadd a, -4  -->  overflow = icmp ugt a, 3
-        if (ConstantInt *CI = dyn_cast<ConstantInt>(II->getArgOperand(1)))
-          return new ICmpInst(ICmpInst::ICMP_UGT, II->getArgOperand(0),
-                              ConstantExpr::getNot(CI));
+        if (II->getIntrinsicID() == Intrinsic::uadd_with_overflow)
+          if (ConstantInt *CI = dyn_cast<ConstantInt>(II->getArgOperand(1)))
+            return new ICmpInst(ICmpInst::ICMP_UGT, II->getArgOperand(0),
+                                ConstantExpr::getNot(CI));
         break;
       case Intrinsic::usub_with_overflow:
       case Intrinsic::ssub_with_overflow: