[llvm-commits] [llvm] r56113 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Dan Gohman gohman at apple.com
Thu Sep 11 11:53:02 PDT 2008


Author: djg
Date: Thu Sep 11 13:53:02 2008
New Revision: 56113

URL: http://llvm.org/viewvc/llvm-project?rev=56113&view=rev
Log:
Fix a copy+paste bug that Duncan spotted. For several
cases it was still getting lucky and detecting overflow
but it was clearly incorrect.

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

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=56113&r1=56112&r2=56113&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 11 13:53:02 2008
@@ -4699,7 +4699,7 @@
 /// overflowed for this type.
 static bool SubWithOverflow(ConstantInt *&Result, ConstantInt *In1,
                             ConstantInt *In2, bool IsSigned = false) {
-  Result = cast<ConstantInt>(Add(In1, In2));
+  Result = cast<ConstantInt>(Subtract(In1, In2));
 
   if (IsSigned)
     if (In2->getValue().isNegative())





More information about the llvm-commits mailing list