aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 0d76dd7..9f1d76b 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1537,7 +1537,7 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0)) {
// If its not weak linkage, the GVal must have a non-zero address
// so the result is greater-than
- if (!GV->hasExternalWeakLinkage())
+ if (!GV->hasExternalWeakLinkage() && CE1GEP->isInBounds())
return ICmpInst::ICMP_UGT;
}
} else if (const GlobalValue *GV2 = dyn_cast<GlobalValue>(V2)) {