From 4ae5fa57b43c06ce77e61664694ef01b64b19b92 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 11 Sep 2008 18:53:02 +0000 Subject: [PATCH] Fix a copy+paste bug that Duncan spotted. For several cases it was still getting lucky and detecting overflow but it was clearly incorrect. llvm-svn: 56113 --- lib/Transforms/Scalar/InstructionCombining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 46ac762b0a7..5a9d1de2e35 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4699,7 +4699,7 @@ static bool AddWithOverflow(ConstantInt *&Result, ConstantInt *In1, /// overflowed for this type. static bool SubWithOverflow(ConstantInt *&Result, ConstantInt *In1, ConstantInt *In2, bool IsSigned = false) { - Result = cast(Add(In1, In2)); + Result = cast(Subtract(In1, In2)); if (IsSigned) if (In2->getValue().isNegative())