summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-06-17 02:05:55 +0000
committerChris Lattner <sabre@nondot.org>2005-06-17 02:05:55 +0000
commit73bcba5f61711e6d84f5d8fb2aa100d04a7a1c48 (patch)
treeb94c186bcafb66cddef5755cb2ecda06499dc345 /llvm/lib/Transforms
parentd230aee4be9091bccd295034c04ea3e4f969e1ad (diff)
downloadbcm5719-llvm-73bcba5f61711e6d84f5d8fb2aa100d04a7a1c48.tar.gz
bcm5719-llvm-73bcba5f61711e6d84f5d8fb2aa100d04a7a1c48.zip
Don't crash when dealing with INTMIN. This fixes PR585 and
Transforms/InstCombine/2005-06-16-RangeCrash.ll llvm-svn: 22234
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 321b032505c..d2827af3d74 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2699,6 +2699,8 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) {
if (CI->isNullValue()) { // (X / neg) op 0
LoBound = AddOne(DivRHS);
HiBound = cast<ConstantInt>(ConstantExpr::getNeg(DivRHS));
+ if (HiBound == DivRHS)
+ LoBound = 0; // - INTMIN = INTMIN
} else if (isPositive(CI)) { // (X / neg) op pos
HiOverflow = LoOverflow = ProdOV;
if (!LoOverflow)
OpenPOWER on IntegriCloud