From 5662503afd2f70c3d6651549af510992ab5afc00 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 17 Jun 2005 02:05:55 +0000 Subject: [PATCH] Don't crash when dealing with INTMIN. This fixes PR585 and Transforms/InstCombine/2005-06-16-RangeCrash.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22234 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 321b032505c..d2827af3d74 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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(ConstantExpr::getNeg(DivRHS)); + if (HiBound == DivRHS) + LoBound = 0; // - INTMIN = INTMIN } else if (isPositive(CI)) { // (X / neg) op pos HiOverflow = LoOverflow = ProdOV; if (!LoOverflow) -- 2.34.1