summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/ConstantFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp
index 7cb4b7bfbe5..f0969fce1f1 100644
--- a/llvm/lib/VMCore/ConstantFolding.cpp
+++ b/llvm/lib/VMCore/ConstantFolding.cpp
@@ -574,7 +574,8 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
if (CI2->isAllOnesValue() &&
(((CI1->getType()->getPrimitiveSizeInBits() == 64) &&
(CI1->getSExtValue() == INT64_MIN)) ||
- (CI1->getSExtValue() == -CI1->getSExtValue())))
+ (CI1->getSExtValue() == -CI1->getSExtValue() &&
+ CI1->getSExtValue())))
return 0; // MIN_INT / -1 -> overflow
return ConstantInt::get(C1->getType(),
CI1->getSExtValue() / CI2->getSExtValue());
OpenPOWER on IntegriCloud