aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/IR/ConstantFold.cpp3
-rw-r--r--llvm/test/Transforms/InstSimplify/ConstProp/poison.ll2
2 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 4c5e1ce..8fce782 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1549,8 +1549,7 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C,
return PoisonValue::get(GEPTy);
if (isa<UndefValue>(C))
- // If inbounds, we can choose an out-of-bounds pointer as a base pointer.
- return InBounds ? PoisonValue::get(GEPTy) : UndefValue::get(GEPTy);
+ return UndefValue::get(GEPTy);
auto IsNoOp = [&]() {
// Avoid losing inrange information.
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/poison.ll b/llvm/test/Transforms/InstSimplify/ConstProp/poison.ll
index cc498ab..8fbe532 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/poison.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/poison.ll
@@ -104,7 +104,7 @@ define void @vec_aggr_ops() {
define void @other_ops(i8 %x) {
; CHECK-LABEL: @other_ops(
-; CHECK-NEXT: call void (...) @use(i1 poison, i1 poison, i8 poison, i8 poison, ptr poison, ptr poison, ptr poison)
+; CHECK-NEXT: call void (...) @use(i1 poison, i1 poison, i8 poison, i8 poison, ptr poison, ptr undef, ptr undef)
; CHECK-NEXT: ret void
;
%i1 = icmp eq i8 poison, 1