[llvm-commits] [llvm] r122204 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Chris Lattner sabre at nondot.org
Sun Dec 19 15:24:04 PST 2010


Author: lattner
Date: Sun Dec 19 17:24:04 2010
New Revision: 122204

URL: http://llvm.org/viewvc/llvm-project?rev=122204&view=rev
Log:
fix an oversight caught by Frits!

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=122204&r1=122203&r2=122204&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Sun Dec 19 17:24:04 2010
@@ -1151,9 +1151,10 @@
         // 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:





More information about the llvm-commits mailing list