[llvm] [InstSimplify] Remove most of undef handling logic (PR #119884)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 06:36:38 PST 2024


https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/119884

>From ea834802567755704e92d284d32b22dfa7a33678 Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Fri, 13 Dec 2024 22:28:46 +0800
Subject: [PATCH 1/2] [InstSimplify] Remove most of undef handling logic

---
 llvm/lib/Analysis/InstructionSimplify.cpp     | 39 ++-------
 .../CodeGen/AMDGPU/nested-loop-conditions.ll  |  4 +-
 .../InstCombine/AMDGPU/amdgcn-intrinsics.ll   | 50 ++++++-----
 llvm/test/Transforms/InstCombine/icmp.ll      | 55 ------------
 .../test/Transforms/InstCombine/is_fpclass.ll |  7 --
 .../InstCombine/vec_demanded_elts.ll          | 10 +--
 .../2011-09-05-InsertExtractValue.ll          |  2 +-
 llvm/test/Transforms/InstSimplify/call.ll     | 62 +++----------
 .../InstSimplify/extract-element.ll           |  2 +-
 llvm/test/Transforms/InstSimplify/gep.ll      | 16 ++--
 .../Transforms/InstSimplify/icmp-constant.ll  |  2 +-
 llvm/test/Transforms/InstSimplify/undef.ll    |  4 +-
 .../InstSimplify/vscale-inseltpoison.ll       |  6 +-
 llvm/test/Transforms/InstSimplify/vscale.ll   |  6 +-
 .../peel-loop-noalias-scope-decl.ll           | 87 ++++++++++---------
 .../LoopUnroll/wrong_assert_in_peeling.ll     | 28 +++---
 16 files changed, 132 insertions(+), 248 deletions(-)

diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 62edea38745b13..21e0cda3e6cb46 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -748,11 +748,6 @@ static Value *simplifySubInst(Value *Op0, Value *Op1, bool IsNSW, bool IsNUW,
   if (isa<PoisonValue>(Op0) || isa<PoisonValue>(Op1))
     return PoisonValue::get(Op0->getType());
 
-  // X - undef -> undef
-  // undef - X -> undef
-  if (Q.isUndefValue(Op0) || Q.isUndefValue(Op1))
-    return UndefValue::get(Op0->getType());
-
   // X - 0 -> X
   if (match(Op1, m_Zero()))
     return Op0;
@@ -3742,15 +3737,8 @@ static Value *simplifyICmpInst(CmpPredicate Pred, Value *LHS, Value *RHS,
   if (isa<PoisonValue>(RHS))
     return PoisonValue::get(ITy);
 
-  // For EQ and NE, we can always pick a value for the undef to make the
-  // predicate pass or fail, so we can return undef.
-  // Matches behavior in llvm::ConstantFoldCompareInstruction.
-  if (Q.isUndefValue(RHS) && ICmpInst::isEquality(Pred))
-    return UndefValue::get(ITy);
-
   // icmp X, X -> true/false
-  // icmp X, undef -> true/false because undef could be X.
-  if (LHS == RHS || Q.isUndefValue(RHS))
+  if (LHS == RHS)
     return ConstantInt::get(ITy, CmpInst::isTrueWhenEqual(Pred));
 
   if (Value *V = simplifyICmpOfBools(Pred, LHS, RHS, Q))
@@ -5002,10 +4990,6 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr,
       any_of(Indices, [](const auto *V) { return isa<PoisonValue>(V); }))
     return PoisonValue::get(GEPTy);
 
-  // getelementptr undef, idx -> undef
-  if (Q.isUndefValue(Ptr))
-    return UndefValue::get(GEPTy);
-
   bool IsScalableVec =
       SrcTy->isScalableTy() || any_of(Indices, [](const Value *V) {
         return isa<ScalableVectorType>(V->getType());
@@ -5223,13 +5207,13 @@ static Value *simplifyExtractElementInst(Value *Vec, Value *Idx,
     if (auto *CIdx = dyn_cast<Constant>(Idx))
       return ConstantExpr::getExtractElement(CVec, CIdx);
 
-    if (Q.isUndefValue(Vec))
-      return UndefValue::get(VecVTy->getElementType());
+    if (isa<PoisonValue>(Vec))
+      return PoisonValue::get(VecVTy->getElementType());
   }
 
-  // An undef extract index can be arbitrarily chosen to be an out-of-range
+  // A poison extract index can be arbitrarily chosen to be an out-of-range
   // index value, which would result in the instruction being poison.
-  if (Q.isUndefValue(Idx))
+  if (isa<PoisonValue>(Idx))
     return PoisonValue::get(VecVTy->getElementType());
 
   // If extracting a specified index from the vector, see if we can recursively
@@ -6673,8 +6657,6 @@ Value *llvm::simplifyBinaryIntrinsic(Intrinsic::ID IID, Type *ReturnType,
       return ConstantInt::get(ReturnType, true);
     if ((Mask & fcAllFlags) == 0)
       return ConstantInt::get(ReturnType, false);
-    if (Q.isUndefValue(Op0))
-      return UndefValue::get(ReturnType);
     break;
   }
   case Intrinsic::maxnum:
@@ -6799,13 +6781,10 @@ static Value *simplifyIntrinsic(CallBase *Call, Value *Callee,
   case Intrinsic::fshr: {
     Value *Op0 = Args[0], *Op1 = Args[1], *ShAmtArg = Args[2];
 
-    // If both operands are undef, the result is undef.
-    if (Q.isUndefValue(Op0) && Q.isUndefValue(Op1))
-      return UndefValue::get(F->getReturnType());
-
-    // If shift amount is undef, assume it is zero.
-    if (Q.isUndefValue(ShAmtArg))
-      return Args[IID == Intrinsic::fshl ? 0 : 1];
+    // If any of the operands is poison, the result is poison.
+    if (isa<PoisonValue>(Op0) || isa<PoisonValue>(Op1) ||
+        isa<PoisonValue>(ShAmtArg))
+      return PoisonValue::get(F->getReturnType());
 
     const APInt *ShAmtC;
     if (match(ShAmtArg, m_APInt(ShAmtC))) {
diff --git a/llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll b/llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll
index bd6ef9e088b12f..fc18580276ebc6 100644
--- a/llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll
+++ b/llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll
@@ -154,7 +154,7 @@ define amdgpu_kernel void @nested_loop_conditions(ptr addrspace(1) nocapture %ar
 ; GCN-NEXT:    v_cmp_lt_i32_e32 vcc, 8, v0
 ; GCN-NEXT:    s_cbranch_vccnz .LBB1_6
 ; GCN-NEXT:  ; %bb.1: ; %bb14.lr.ph
-; GCN-NEXT:    s_load_dword s4, s[0:1], 0x0
+; GCN-NEXT:    s_load_dwordx4 s[4:7], s[0:1], 0x0
 ; GCN-NEXT:    s_branch .LBB1_3
 ; GCN-NEXT:  .LBB1_2: ; %Flow
 ; GCN-NEXT:    ; in Loop: Header=BB1_3 Depth=1
@@ -179,7 +179,7 @@ define amdgpu_kernel void @nested_loop_conditions(ptr addrspace(1) nocapture %ar
 ; GCN-NEXT:    s_cbranch_vccnz .LBB1_4
 ; GCN-NEXT:  ; %bb.5: ; %bb21
 ; GCN-NEXT:    ; in Loop: Header=BB1_3 Depth=1
-; GCN-NEXT:    s_load_dword s4, s[0:1], 0x0
+; GCN-NEXT:    s_load_dwordx4 s[4:7], s[0:1], 0x0
 ; GCN-NEXT:    buffer_load_dword v0, off, s[0:3], 0 glc
 ; GCN-NEXT:    s_waitcnt vmcnt(0)
 ; GCN-NEXT:    v_cmp_lt_i32_e64 s[0:1], 8, v0
diff --git a/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll b/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
index 5fdb918c875459..680fee2693202b 100644
--- a/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
+++ b/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
@@ -66,7 +66,7 @@ define double @test_constant_fold_rcp_f64_43() nounwind {
 
 define float @test_constant_fold_rcp_f32_43_strictfp() nounwind strictfp {
 ; CHECK-LABEL: @test_constant_fold_rcp_f32_43_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.rcp.f32(float 4.300000e+01) #[[ATTR14:[0-9]+]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.rcp.f32(float 4.300000e+01) #[[ATTR15:[0-9]+]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.rcp.f32(float 4.300000e+01) strictfp nounwind readnone
@@ -115,7 +115,7 @@ define half @test_constant_fold_sqrt_f16_0() nounwind {
 
 define float @test_constant_fold_sqrt_f32_0() nounwind {
 ; CHECK-LABEL: @test_constant_fold_sqrt_f32_0(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.sqrt.f32(float 0.000000e+00) #[[ATTR15:[0-9]+]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.sqrt.f32(float 0.000000e+00) #[[ATTR16:[0-9]+]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.sqrt.f32(float 0.0) nounwind readnone
@@ -124,7 +124,7 @@ define float @test_constant_fold_sqrt_f32_0() nounwind {
 
 define double @test_constant_fold_sqrt_f64_0() nounwind {
 ; CHECK-LABEL: @test_constant_fold_sqrt_f64_0(
-; CHECK-NEXT:    [[VAL:%.*]] = call double @llvm.amdgcn.sqrt.f64(double 0.000000e+00) #[[ATTR15]]
+; CHECK-NEXT:    [[VAL:%.*]] = call double @llvm.amdgcn.sqrt.f64(double 0.000000e+00) #[[ATTR16]]
 ; CHECK-NEXT:    ret double [[VAL]]
 ;
   %val = call double @llvm.amdgcn.sqrt.f64(double 0.0) nounwind readnone
@@ -141,7 +141,7 @@ define half @test_constant_fold_sqrt_f16_neg0() nounwind {
 
 define float @test_constant_fold_sqrt_f32_neg0() nounwind {
 ; CHECK-LABEL: @test_constant_fold_sqrt_f32_neg0(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.sqrt.f32(float -0.000000e+00) #[[ATTR15]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.sqrt.f32(float -0.000000e+00) #[[ATTR16]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.sqrt.f32(float -0.0) nounwind readnone
@@ -150,7 +150,7 @@ define float @test_constant_fold_sqrt_f32_neg0() nounwind {
 
 define double @test_constant_fold_sqrt_f64_neg0() nounwind {
 ; CHECK-LABEL: @test_constant_fold_sqrt_f64_neg0(
-; CHECK-NEXT:    [[VAL:%.*]] = call double @llvm.amdgcn.sqrt.f64(double -0.000000e+00) #[[ATTR15]]
+; CHECK-NEXT:    [[VAL:%.*]] = call double @llvm.amdgcn.sqrt.f64(double -0.000000e+00) #[[ATTR16]]
 ; CHECK-NEXT:    ret double [[VAL]]
 ;
   %val = call double @llvm.amdgcn.sqrt.f64(double -0.0) nounwind readnone
@@ -667,7 +667,7 @@ define i1 @test_class_undef_full_mask_f32() nounwind {
 
 define i1 @test_class_undef_val_f32() nounwind {
 ; CHECK-LABEL: @test_class_undef_val_f32(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 false
 ;
   %val = call i1 @llvm.amdgcn.class.f32(float undef, i32 4)
   ret i1 %val
@@ -718,7 +718,7 @@ define i1 @test_class_isnan_f32(float %x) nounwind {
 
 define i1 @test_class_isnan_f32_strict(float %x) nounwind strictfp {
 ; CHECK-LABEL: @test_class_isnan_f32_strict(
-; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 3) #[[ATTR16:[0-9]+]]
+; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 3) #[[ATTR17:[0-9]+]]
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 3) strictfp
@@ -736,7 +736,7 @@ define i1 @test_class_is_p0_n0_f32(float %x) nounwind {
 
 define i1 @test_class_is_p0_n0_f32_strict(float %x) nounwind strictfp {
 ; CHECK-LABEL: @test_class_is_p0_n0_f32_strict(
-; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 96) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call i1 @llvm.is.fpclass.f32(float [[X:%.*]], i32 96) #[[ATTR17]]
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.amdgcn.class.f32(float %x, i32 96) strictfp
@@ -2000,7 +2000,7 @@ define i64 @icmp_constant_inputs_false() {
 
 define i64 @icmp_constant_inputs_true() {
 ; CHECK-LABEL: @icmp_constant_inputs_true(
-; CHECK-NEXT:    [[RESULT:%.*]] = call i64 @llvm.read_register.i64(metadata [[META0:![0-9]+]]) #[[ATTR17:[0-9]+]]
+; CHECK-NEXT:    [[RESULT:%.*]] = call i64 @llvm.read_register.i64(metadata [[META0:![0-9]+]]) #[[ATTR18:[0-9]+]]
 ; CHECK-NEXT:    ret i64 [[RESULT]]
 ;
   %result = call i64 @llvm.amdgcn.icmp.i64.i32(i32 9, i32 8, i32 34)
@@ -2707,7 +2707,7 @@ define i64 @fcmp_constant_inputs_false() {
 
 define i64 @fcmp_constant_inputs_true() {
 ; CHECK-LABEL: @fcmp_constant_inputs_true(
-; CHECK-NEXT:    [[RESULT:%.*]] = call i64 @llvm.read_register.i64(metadata [[META0]]) #[[ATTR17]]
+; CHECK-NEXT:    [[RESULT:%.*]] = call i64 @llvm.read_register.i64(metadata [[META0]]) #[[ATTR18]]
 ; CHECK-NEXT:    ret i64 [[RESULT]]
 ;
   %result = call i64 @llvm.amdgcn.fcmp.i64.f32(float 2.0, float 4.0, i32 4)
@@ -5829,7 +5829,7 @@ define double @trig_preop_constfold_neg32_segment() {
 
 define double @trig_preop_constfold_strictfp() strictfp {
 ; CHECK-LABEL: @trig_preop_constfold_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call double @llvm.amdgcn.trig.preop.f64(double 3.454350e+02, i32 5) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call double @llvm.amdgcn.trig.preop.f64(double 3.454350e+02, i32 5) #[[ATTR17]]
 ; CHECK-NEXT:    ret double [[VAL]]
 ;
   %val = call double @llvm.amdgcn.trig.preop.f64(double 3.454350e+02, i32 5) strictfp
@@ -6198,7 +6198,7 @@ define half @test_constant_fold_log_f16_neg10() {
 
 define float @test_constant_fold_log_f32_qnan_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_log_f32_qnan_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float 0x7FF8000000000000) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float 0x7FF8000000000000) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.log.f32(float 0x7FF8000000000000) strictfp
@@ -6207,7 +6207,7 @@ define float @test_constant_fold_log_f32_qnan_strictfp() strictfp {
 
 define float @test_constant_fold_log_f32_0_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_log_f32_0_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float 0.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float 0.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.log.f32(float 0.0) strictfp
@@ -6216,7 +6216,7 @@ define float @test_constant_fold_log_f32_0_strictfp() strictfp {
 
 define float @test_constant_fold_log_f32_neg0_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_log_f32_neg0_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float -0.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float -0.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.log.f32(float -0.0) strictfp
@@ -6225,7 +6225,7 @@ define float @test_constant_fold_log_f32_neg0_strictfp() strictfp {
 
 define float @test_constant_fold_log_f32_neg_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_log_f32_neg_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float -1.000000e+01) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float -1.000000e+01) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.log.f32(float -10.0) strictfp
@@ -6242,7 +6242,7 @@ define float @test_constant_fold_log_f32_pinf_strictfp() strictfp {
 
 define float @test_constant_fold_log_f32_ninf_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_log_f32_ninf_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float 0xFFF0000000000000) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.log.f32(float 0xFFF0000000000000) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.log.f32(float 0xFFF0000000000000) strictfp
@@ -6444,7 +6444,7 @@ define half @test_constant_fold_exp2_f16_neg10() {
 
 define float @test_constant_fold_exp2_f32_qnan_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_qnan_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 0x7FF8000000000000) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 0x7FF8000000000000) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float 0x7FF8000000000000) strictfp
@@ -6453,7 +6453,7 @@ define float @test_constant_fold_exp2_f32_qnan_strictfp() strictfp {
 
 define float @test_constant_fold_exp2_f32_0_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_0_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 0.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 0.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float 0.0) strictfp
@@ -6462,7 +6462,7 @@ define float @test_constant_fold_exp2_f32_0_strictfp() strictfp {
 
 define float @test_constant_fold_exp2_f32_neg0_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_neg0_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -0.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -0.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float -0.0) strictfp
@@ -6471,7 +6471,7 @@ define float @test_constant_fold_exp2_f32_neg0_strictfp() strictfp {
 
 define float @test_constant_fold_exp2_f32_1_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_1_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 1.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 1.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float 1.0) strictfp
@@ -6480,7 +6480,7 @@ define float @test_constant_fold_exp2_f32_1_strictfp() strictfp {
 
 define float @test_constant_fold_exp2_f32_neg1_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_neg1_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -1.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -1.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float -1.0) strictfp
@@ -6489,7 +6489,7 @@ define float @test_constant_fold_exp2_f32_neg1_strictfp() strictfp {
 
 define float @test_constant_fold_exp2_f32_2_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_2_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 2.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float 2.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float 2.0) strictfp
@@ -6498,7 +6498,7 @@ define float @test_constant_fold_exp2_f32_2_strictfp() strictfp {
 
 define float @test_constant_fold_exp2_f32_neg2_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_neg2_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -2.000000e+00) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -2.000000e+00) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float -2.0) strictfp
@@ -6507,7 +6507,7 @@ define float @test_constant_fold_exp2_f32_neg2_strictfp() strictfp {
 
 define float @test_constant_fold_exp2_f32_neg_strictfp() strictfp {
 ; CHECK-LABEL: @test_constant_fold_exp2_f32_neg_strictfp(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -1.000000e+01) #[[ATTR16]]
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.amdgcn.exp2.f32(float -1.000000e+01) #[[ATTR17]]
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.amdgcn.exp2.f32(float -10.0) strictfp
@@ -6555,6 +6555,7 @@ declare i32 @llvm.amdgcn.prng.b32(i32)
 define i32 @prng_undef_i32() {
 ; CHECK-LABEL: @prng_undef_i32(
 ; CHECK-NEXT:    ret i32 undef
+;
   %prng = call i32 @llvm.amdgcn.prng.b32(i32 undef)
   ret i32 %prng
 }
@@ -6562,6 +6563,7 @@ define i32 @prng_undef_i32() {
 define i32 @prng_poison_i32() {
 ; CHECK-LABEL: @prng_poison_i32(
 ; CHECK-NEXT:    ret i32 poison
+;
   %prng = call i32 @llvm.amdgcn.prng.b32(i32 poison)
   ret i32 %prng
 }
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index 6e1486660b24d7..ea1deb6d460bdd 100644
--- a/llvm/test/Transforms/InstCombine/icmp.ll
+++ b/llvm/test/Transforms/InstCombine/icmp.ll
@@ -73,28 +73,6 @@ define i32 @test4(i32 %X) {
   ret i32 %b
 }
 
-; PR4837
-define <2 x i1> @test5_eq(<2 x i64> %x) {
-; CHECK-LABEL: @test5_eq(
-; CHECK-NEXT:    ret <2 x i1> undef
-;
-  %V = icmp eq <2 x i64> %x, undef
-  ret <2 x i1> %V
-}
-define <2 x i1> @test5_ne(<2 x i64> %x) {
-; CHECK-LABEL: @test5_ne(
-; CHECK-NEXT:    ret <2 x i1> undef
-;
-  %V = icmp ne <2 x i64> %x, undef
-  ret <2 x i1> %V
-}
-define <2 x i1> @test5_ugt(<2 x i64> %x) {
-; CHECK-LABEL: @test5_ugt(
-; CHECK-NEXT:    ret <2 x i1> zeroinitializer
-;
-  %V = icmp ugt <2 x i64> %x, undef
-  ret <2 x i1> %V
-}
 define <2 x i1> @test5_zero() {
 ; CHECK-LABEL: @test5_zero(
 ; CHECK-NEXT:    ret <2 x i1> undef
@@ -264,39 +242,6 @@ define i1 @test12(i1 %A) {
   ret i1 %B
 }
 
-; PR6481
-define i1 @test13(i8 %X) {
-; CHECK-LABEL: @test13(
-; CHECK-NEXT:    ret i1 false
-;
-  %cmp = icmp slt i8 undef, %X
-  ret i1 %cmp
-}
-
-define i1 @test14(i8 %X) {
-; CHECK-LABEL: @test14(
-; CHECK-NEXT:    ret i1 false
-;
-  %cmp = icmp slt i8 undef, -128
-  ret i1 %cmp
-}
-
-define i1 @test15() {
-; CHECK-LABEL: @test15(
-; CHECK-NEXT:    ret i1 undef
-;
-  %cmp = icmp eq i8 undef, -128
-  ret i1 %cmp
-}
-
-define i1 @test16() {
-; CHECK-LABEL: @test16(
-; CHECK-NEXT:    ret i1 undef
-;
-  %cmp = icmp ne i8 undef, -128
-  ret i1 %cmp
-}
-
 define i1 @test17(i32 %x) {
 ; CHECK-LABEL: @test17(
 ; CHECK-NEXT:    [[TMP1:%.*]] = icmp ne i32 [[X:%.*]], 3
diff --git a/llvm/test/Transforms/InstCombine/is_fpclass.ll b/llvm/test/Transforms/InstCombine/is_fpclass.ll
index c1809b8bec61cb..c39587ce8a2abb 100644
--- a/llvm/test/Transforms/InstCombine/is_fpclass.ll
+++ b/llvm/test/Transforms/InstCombine/is_fpclass.ll
@@ -59,13 +59,6 @@ define i1 @test_class_poison_full_mask_f32() {
   ret i1 %val
 }
 
-define i1 @test_class_undef_val_f32() {
-; CHECK-LABEL: @test_class_undef_val_f32(
-; CHECK-NEXT:    ret i1 undef
-;
-  %val = call i1 @llvm.is.fpclass.f32(float undef, i32 4)
-  ret i1 %val
-}
 
 define i1 @test_class_poison_val_f32() {
 ; CHECK-LABEL: @test_class_poison_val_f32(
diff --git a/llvm/test/Transforms/InstCombine/vec_demanded_elts.ll b/llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
index ee7ef9955e643f..e6c4034cecd932 100644
--- a/llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
+++ b/llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
@@ -628,12 +628,12 @@ define <2 x ptr> @gep_all_lanes_undef(ptr %base, i64 %idx) {;
   ret <2 x ptr> %gep
 }
 
-define ptr @gep_demanded_lane_undef(ptr %base, i64 %idx) {
-; CHECK-LABEL: @gep_demanded_lane_undef(
-; CHECK-NEXT:    ret ptr undef
+define ptr @gep_demanded_lane_poison(ptr %base, i64 %idx) {
+; CHECK-LABEL: @gep_demanded_lane_poison(
+; CHECK-NEXT:    ret ptr poison
 ;
-  %basevec = insertelement <2 x ptr> undef, ptr %base, i32 0
-  %idxvec = insertelement <2 x i64> undef, i64 %idx, i32 1
+  %basevec = insertelement <2 x ptr> poison, ptr %base, i32 0
+  %idxvec = insertelement <2 x i64> poison, i64 %idx, i32 1
   %gep = getelementptr i32, <2 x ptr> %basevec, <2 x i64> %idxvec
   %ee = extractelement <2 x ptr> %gep, i32 1
   ret ptr %ee
diff --git a/llvm/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll b/llvm/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
index 9c364d16badee7..bf6a91c2707b5c 100644
--- a/llvm/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
+++ b/llvm/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
@@ -66,6 +66,6 @@ define i32 @test5(<4 x i32> %V) {
 ; CHECK-LABEL: @test5(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %extract = extractelement <4 x i32> %V, i32 undef
+  %extract = extractelement <4 x i32> %V, i32 poison
   ret i32 %extract
 }
diff --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index 67d5c4dbfb2e7d..97e7769a40ba78 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -826,48 +826,11 @@ define <2 x i8> @rotr_zero_shift_guard_splat(<2 x i8> %x, <2 x i8> %sh) {
   ret <2 x i8> %s
 }
 
-; If first two operands of funnel shift are undef, the result is undef
-
-define i8 @fshl_ops_undef(i8 %shamt) {
-; CHECK-LABEL: @fshl_ops_undef(
-; CHECK-NEXT:    ret i8 undef
-;
-  %r = call i8 @llvm.fshl.i8(i8 undef, i8 undef, i8 %shamt)
-  ret i8 %r
-}
-
-define i9 @fshr_ops_undef(i9 %shamt) {
-; CHECK-LABEL: @fshr_ops_undef(
-; CHECK-NEXT:    ret i9 undef
-;
-  %r = call i9 @llvm.fshr.i9(i9 undef, i9 undef, i9 %shamt)
-  ret i9 %r
-}
-
-; If shift amount is undef, treat it as zero, returning operand 0 or 1
-
-define i8 @fshl_shift_undef(i8 %x, i8 %y) {
-; CHECK-LABEL: @fshl_shift_undef(
-; CHECK-NEXT:    ret i8 [[X:%.*]]
-;
-  %r = call i8 @llvm.fshl.i8(i8 %x, i8 %y, i8 undef)
-  ret i8 %r
-}
-
-define i9 @fshr_shift_undef(i9 %x, i9 %y) {
-; CHECK-LABEL: @fshr_shift_undef(
-; CHECK-NEXT:    ret i9 [[Y:%.*]]
-;
-  %r = call i9 @llvm.fshr.i9(i9 %x, i9 %y, i9 undef)
-  ret i9 %r
-}
 
 ; If one of operands is poison, the result is poison
-; TODO: these should be poison
 define i8 @fshl_ops_poison(i8 %b, i8 %shamt) {
 ; CHECK-LABEL: @fshl_ops_poison(
-; CHECK-NEXT:    [[R:%.*]] = call i8 @llvm.fshl.i8(i8 poison, i8 [[B:%.*]], i8 [[SHAMT:%.*]])
-; CHECK-NEXT:    ret i8 [[R]]
+; CHECK-NEXT:    ret i8 poison
 ;
   %r = call i8 @llvm.fshl.i8(i8 poison, i8 %b, i8 %shamt)
   ret i8 %r
@@ -875,7 +838,7 @@ define i8 @fshl_ops_poison(i8 %b, i8 %shamt) {
 
 define i8 @fshl_ops_poison2(i8 %shamt) {
 ; CHECK-LABEL: @fshl_ops_poison2(
-; CHECK-NEXT:    ret i8 undef
+; CHECK-NEXT:    ret i8 poison
 ;
   %r = call i8 @llvm.fshl.i8(i8 poison, i8 undef, i8 %shamt)
   ret i8 %r
@@ -883,8 +846,7 @@ define i8 @fshl_ops_poison2(i8 %shamt) {
 
 define i8 @fshl_ops_poison3(i8 %a, i8 %shamt) {
 ; CHECK-LABEL: @fshl_ops_poison3(
-; CHECK-NEXT:    [[R:%.*]] = call i8 @llvm.fshl.i8(i8 [[A:%.*]], i8 poison, i8 [[SHAMT:%.*]])
-; CHECK-NEXT:    ret i8 [[R]]
+; CHECK-NEXT:    ret i8 poison
 ;
   %r = call i8 @llvm.fshl.i8(i8 %a, i8 poison, i8 %shamt)
   ret i8 %r
@@ -892,15 +854,15 @@ define i8 @fshl_ops_poison3(i8 %a, i8 %shamt) {
 
 define i8 @fshl_ops_poison4(i8 %shamt) {
 ; CHECK-LABEL: @fshl_ops_poison4(
-; CHECK-NEXT:    ret i8 undef
+; CHECK-NEXT:    ret i8 poison
 ;
-  %r = call i8 @llvm.fshl.i8(i8 undef, i8 poison, i8 %shamt)
+  %r = call i8 @llvm.fshl.i8(i8 0, i8 poison, i8 %shamt)
   ret i8 %r
 }
 
 define i8 @fshl_ops_poison5(i8 %a, i8 %b) {
 ; CHECK-LABEL: @fshl_ops_poison5(
-; CHECK-NEXT:    ret i8 [[A:%.*]]
+; CHECK-NEXT:    ret i8 poison
 ;
   %r = call i8 @llvm.fshl.i8(i8 %a, i8 %b, i8 poison)
   ret i8 %r
@@ -916,8 +878,7 @@ define i8 @fshl_ops_poison6() {
 
 define i9 @fshr_ops_poison(i9 %b, i9 %shamt) {
 ; CHECK-LABEL: @fshr_ops_poison(
-; CHECK-NEXT:    [[R:%.*]] = call i9 @llvm.fshr.i9(i9 poison, i9 [[B:%.*]], i9 [[SHAMT:%.*]])
-; CHECK-NEXT:    ret i9 [[R]]
+; CHECK-NEXT:    ret i9 poison
 ;
   %r = call i9 @llvm.fshr.i9(i9 poison, i9 %b, i9 %shamt)
   ret i9 %r
@@ -925,7 +886,7 @@ define i9 @fshr_ops_poison(i9 %b, i9 %shamt) {
 
 define i9 @fshr_ops_poison2(i9 %shamt) {
 ; CHECK-LABEL: @fshr_ops_poison2(
-; CHECK-NEXT:    ret i9 undef
+; CHECK-NEXT:    ret i9 poison
 ;
   %r = call i9 @llvm.fshr.i9(i9 poison, i9 undef, i9 %shamt)
   ret i9 %r
@@ -933,8 +894,7 @@ define i9 @fshr_ops_poison2(i9 %shamt) {
 
 define i9 @fshr_ops_poison3(i9 %a, i9 %shamt) {
 ; CHECK-LABEL: @fshr_ops_poison3(
-; CHECK-NEXT:    [[R:%.*]] = call i9 @llvm.fshr.i9(i9 [[A:%.*]], i9 poison, i9 [[SHAMT:%.*]])
-; CHECK-NEXT:    ret i9 [[R]]
+; CHECK-NEXT:    ret i9 poison
 ;
   %r = call i9 @llvm.fshr.i9(i9 %a, i9 poison, i9 %shamt)
   ret i9 %r
@@ -942,7 +902,7 @@ define i9 @fshr_ops_poison3(i9 %a, i9 %shamt) {
 
 define i9 @fshr_ops_poison4(i9 %shamt) {
 ; CHECK-LABEL: @fshr_ops_poison4(
-; CHECK-NEXT:    ret i9 undef
+; CHECK-NEXT:    ret i9 poison
 ;
   %r = call i9 @llvm.fshr.i9(i9 undef, i9 poison, i9 %shamt)
   ret i9 %r
@@ -950,7 +910,7 @@ define i9 @fshr_ops_poison4(i9 %shamt) {
 
 define i9 @fshr_ops_poison5(i9 %a, i9 %b) {
 ; CHECK-LABEL: @fshr_ops_poison5(
-; CHECK-NEXT:    ret i9 [[B:%.*]]
+; CHECK-NEXT:    ret i9 poison
 ;
   %r = call i9 @llvm.fshr.i9(i9 %a, i9 %b, i9 poison)
   ret i9 %r
diff --git a/llvm/test/Transforms/InstSimplify/extract-element.ll b/llvm/test/Transforms/InstSimplify/extract-element.ll
index 7d30805f4fdc71..33d2c52ed5a0c9 100644
--- a/llvm/test/Transforms/InstSimplify/extract-element.ll
+++ b/llvm/test/Transforms/InstSimplify/extract-element.ll
@@ -32,7 +32,7 @@ define i129 @vec_extract_undef_index(<3 x i129> %a) {
 ; CHECK-LABEL: @vec_extract_undef_index(
 ; CHECK-NEXT:    ret i129 poison
 ;
-  %E1 = extractelement <3 x i129> %a, i129 undef
+  %E1 = extractelement <3 x i129> %a, i129 poison
   ret i129 %E1
 }
 
diff --git a/llvm/test/Transforms/InstSimplify/gep.ll b/llvm/test/Transforms/InstSimplify/gep.ll
index a330f5cbc92681..7bb9fb95e27742 100644
--- a/llvm/test/Transforms/InstSimplify/gep.ll
+++ b/llvm/test/Transforms/InstSimplify/gep.ll
@@ -161,19 +161,19 @@ define ptr @test7(ptr %b, ptr %e) {
   ret ptr %gep
 }
 
-define ptr @undef_inbounds_var_idx(i64 %idx) {
-; CHECK-LABEL: @undef_inbounds_var_idx(
-; CHECK-NEXT:    ret ptr undef
+define ptr @poison_inbounds_var_idx(i64 %idx) {
+; CHECK-LABEL: @poison_inbounds_var_idx(
+; CHECK-NEXT:    ret ptr poison
 ;
-  %el = getelementptr inbounds i64, ptr undef, i64 %idx
+  %el = getelementptr inbounds i64, ptr poison, i64 %idx
   ret ptr %el
 }
 
-define ptr @undef_no_inbounds_var_idx(i64 %idx) {
-; CHECK-LABEL: @undef_no_inbounds_var_idx(
-; CHECK-NEXT:    ret ptr undef
+define ptr @poison_no_inbounds_var_idx(i64 %idx) {
+; CHECK-LABEL: @poison_no_inbounds_var_idx(
+; CHECK-NEXT:    ret ptr poison
 ;
-  %el = getelementptr i64, ptr undef, i64 %idx
+  %el = getelementptr i64, ptr poison, i64 %idx
   ret ptr %el
 }
 
diff --git a/llvm/test/Transforms/InstSimplify/icmp-constant.ll b/llvm/test/Transforms/InstSimplify/icmp-constant.ll
index 21244f832cbb94..f6ea6b4578ba32 100644
--- a/llvm/test/Transforms/InstSimplify/icmp-constant.ll
+++ b/llvm/test/Transforms/InstSimplify/icmp-constant.ll
@@ -1137,7 +1137,7 @@ define <2 x i1> @heterogeneous_constvector(<2 x i8> %x) {
 ; CHECK-LABEL: @heterogeneous_constvector(
 ; CHECK-NEXT:    ret <2 x i1> zeroinitializer
 ;
-  %c = icmp ult <2 x i8> %x, <i8 undef, i8 poison>
+  %c = icmp ult <2 x i8> %x, <i8 0, i8 poison>
   ret <2 x i1> %c
 }
 
diff --git a/llvm/test/Transforms/InstSimplify/undef.ll b/llvm/test/Transforms/InstSimplify/undef.ll
index b32744fe8a3bb1..f821cf874f71fc 100644
--- a/llvm/test/Transforms/InstSimplify/undef.ll
+++ b/llvm/test/Transforms/InstSimplify/undef.ll
@@ -332,9 +332,9 @@ define i32 @test35(<4 x i32> %V) {
 
 define i32 @test36(i32 %V) {
 ; CHECK-LABEL: @test36(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = extractelement <4 x i32> undef, i32 %V
+  %b = extractelement <4 x i32> poison, i32 %V
   ret i32 %b
 }
 
diff --git a/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll b/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll
index 70ca39da953101..b2515bbc95eba2 100644
--- a/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll
+++ b/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll
@@ -70,11 +70,11 @@ define <vscale x 4 x i32> @insertelement_shufflevector_inline_to_ret() {
 
 ; extractelement
 
-define i32 @extractelement_idx_undef(<vscale x 4 x i32> %a) {
-; CHECK-LABEL: @extractelement_idx_undef(
+define i32 @extractelement_idx_poison(<vscale x 4 x i32> %a) {
+; CHECK-LABEL: @extractelement_idx_poison(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %r = extractelement <vscale x 4 x i32> %a, i64 undef
+  %r = extractelement <vscale x 4 x i32> %a, i64 poison
   ret i32 %r
 }
 
diff --git a/llvm/test/Transforms/InstSimplify/vscale.ll b/llvm/test/Transforms/InstSimplify/vscale.ll
index 47cd88f4d5e4a1..da88e479aa7e42 100644
--- a/llvm/test/Transforms/InstSimplify/vscale.ll
+++ b/llvm/test/Transforms/InstSimplify/vscale.ll
@@ -70,11 +70,11 @@ define <vscale x 4 x i32> @insertelement_shufflevector_inline_to_ret() {
 
 ; extractelement
 
-define i32 @extractelement_idx_undef(<vscale x 4 x i32> %a) {
-; CHECK-LABEL: @extractelement_idx_undef(
+define i32 @extractelement_idx_poison(<vscale x 4 x i32> %a) {
+; CHECK-LABEL: @extractelement_idx_poison(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %r = extractelement <vscale x 4 x i32> %a, i64 undef
+  %r = extractelement <vscale x 4 x i32> %a, i64 poison
   ret i32 %r
 }
 
diff --git a/llvm/test/Transforms/LoopUnroll/peel-loop-noalias-scope-decl.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-noalias-scope-decl.ll
index 839bdbd541e4b5..b38adc5ce18943 100644
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-noalias-scope-decl.ll
+++ b/llvm/test/Transforms/LoopUnroll/peel-loop-noalias-scope-decl.ll
@@ -7,40 +7,40 @@ target triple = "x86_64-unknown-linux-gnu"
 
 ; Loop peeling must result in valid scope declartions
 
-define internal fastcc void @test01(ptr %p0, ptr %p1, ptr %p2) unnamed_addr align 2 {
+define internal fastcc void @test01(ptr %p0, ptr %p1, ptr %p2, i32 %n) unnamed_addr align 2 {
 ; CHECK-LABEL: @test01(
 ; CHECK-NEXT:  for.body47.lr.ph:
-; CHECK-NEXT:    call void @llvm.experimental.noalias.scope.decl(metadata !0)
+; CHECK-NEXT:    call void @llvm.experimental.noalias.scope.decl(metadata [[META0:![0-9]+]])
 ; CHECK-NEXT:    br label [[FOR_BODY47_PEEL_BEGIN:%.*]]
 ; CHECK:       for.body47.peel.begin:
 ; CHECK-NEXT:    br label [[FOR_BODY47_PEEL:%.*]]
 ; CHECK:       for.body47.peel:
-; CHECK-NEXT:    call void @llvm.experimental.noalias.scope.decl(metadata !3)
-; CHECK-NEXT:    store i8 42, ptr [[P0:%.*]], align 1, !alias.scope !3
-; CHECK-NEXT:    store i8 43, ptr [[P1:%.*]], align 1, !alias.scope !0
-; CHECK-NEXT:    store i8 44, ptr [[P2:%.*]], align 1, !alias.scope !5
-; CHECK-NEXT:    store i8 42, ptr [[P0]], align 1, !noalias !3
-; CHECK-NEXT:    store i8 43, ptr [[P1]], align 1, !noalias !0
-; CHECK-NEXT:    store i8 44, ptr [[P2]], align 1, !noalias !5
+; CHECK-NEXT:    call void @llvm.experimental.noalias.scope.decl(metadata [[META3:![0-9]+]])
+; CHECK-NEXT:    store i8 42, ptr [[P0:%.*]], align 1, !alias.scope [[META3]]
+; CHECK-NEXT:    store i8 43, ptr [[P1:%.*]], align 1, !alias.scope [[META0]]
+; CHECK-NEXT:    store i8 44, ptr [[P2:%.*]], align 1, !alias.scope [[META5:![0-9]+]]
+; CHECK-NEXT:    store i8 42, ptr [[P0]], align 1, !noalias [[META3]]
+; CHECK-NEXT:    store i8 43, ptr [[P1]], align 1, !noalias [[META0]]
+; CHECK-NEXT:    store i8 44, ptr [[P2]], align 1, !noalias [[META5]]
 ; CHECK-NEXT:    [[CMP52_PEEL:%.*]] = icmp eq i32 0, 0
 ; CHECK-NEXT:    br i1 [[CMP52_PEEL]], label [[COND_TRUE_PEEL:%.*]], label [[COND_END_PEEL:%.*]]
 ; CHECK:       cond.true.peel:
-; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !alias.scope !3
-; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !alias.scope !0
-; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !alias.scope !5
-; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !noalias !3
-; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !noalias !0
-; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !noalias !5
+; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !alias.scope [[META3]]
+; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !alias.scope [[META0]]
+; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !alias.scope [[META5]]
+; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !noalias [[META3]]
+; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !noalias [[META0]]
+; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !noalias [[META5]]
 ; CHECK-NEXT:    br label [[COND_END_PEEL]]
 ; CHECK:       cond.end.peel:
-; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !alias.scope !3
-; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !alias.scope !0
-; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !alias.scope !5
-; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !noalias !3
-; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !noalias !0
-; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !noalias !5
+; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !alias.scope [[META3]]
+; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !alias.scope [[META0]]
+; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !alias.scope [[META5]]
+; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !noalias [[META3]]
+; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !noalias [[META0]]
+; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !noalias [[META5]]
 ; CHECK-NEXT:    [[INC_PEEL:%.*]] = add nuw i32 0, 1
-; CHECK-NEXT:    [[EXITCOND_NOT_PEEL:%.*]] = icmp eq i32 [[INC_PEEL]], undef
+; CHECK-NEXT:    [[EXITCOND_NOT_PEEL:%.*]] = icmp eq i32 [[INC_PEEL]], [[N:%.*]]
 ; CHECK-NEXT:    br i1 [[EXITCOND_NOT_PEEL]], label [[FOR_COND_CLEANUP46:%.*]], label [[FOR_BODY47_PEEL_NEXT:%.*]]
 ; CHECK:       for.body47.peel.next:
 ; CHECK-NEXT:    br label [[FOR_BODY47_PEEL_NEXT1:%.*]]
@@ -54,31 +54,32 @@ define internal fastcc void @test01(ptr %p0, ptr %p1, ptr %p2) unnamed_addr alig
 ; CHECK-NEXT:    ret void
 ; CHECK:       for.body47:
 ; CHECK-NEXT:    [[J_02:%.*]] = phi i32 [ [[INC_PEEL]], [[FOR_BODY47_LR_PH_PEEL_NEWPH]] ], [ [[INC:%.*]], [[COND_END:%.*]] ]
-; CHECK-NEXT:    call void @llvm.experimental.noalias.scope.decl(metadata !6)
-; CHECK-NEXT:    store i8 42, ptr [[P0]], align 1, !alias.scope !6
-; CHECK-NEXT:    store i8 43, ptr [[P1]], align 1, !alias.scope !0
-; CHECK-NEXT:    store i8 44, ptr [[P2]], align 1, !alias.scope !8
-; CHECK-NEXT:    store i8 42, ptr [[P0]], align 1, !noalias !6
-; CHECK-NEXT:    store i8 43, ptr [[P1]], align 1, !noalias !0
-; CHECK-NEXT:    store i8 44, ptr [[P2]], align 1, !noalias !8
+; CHECK-NEXT:    call void @llvm.experimental.noalias.scope.decl(metadata [[META6:![0-9]+]])
+; CHECK-NEXT:    store i8 42, ptr [[P0]], align 1, !alias.scope [[META6]]
+; CHECK-NEXT:    store i8 43, ptr [[P1]], align 1, !alias.scope [[META0]]
+; CHECK-NEXT:    store i8 44, ptr [[P2]], align 1, !alias.scope [[META8:![0-9]+]]
+; CHECK-NEXT:    store i8 42, ptr [[P0]], align 1, !noalias [[META6]]
+; CHECK-NEXT:    store i8 43, ptr [[P1]], align 1, !noalias [[META0]]
+; CHECK-NEXT:    store i8 44, ptr [[P2]], align 1, !noalias [[META8]]
 ; CHECK-NEXT:    br i1 false, label [[COND_TRUE:%.*]], label [[COND_END]]
 ; CHECK:       cond.true:
-; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !alias.scope !6
-; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !alias.scope !0
-; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !alias.scope !8
-; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !noalias !6
-; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !noalias !0
-; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !noalias !8
+; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !alias.scope [[META6]]
+; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !alias.scope [[META0]]
+; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !alias.scope [[META8]]
+; CHECK-NEXT:    store i8 52, ptr [[P0]], align 1, !noalias [[META6]]
+; CHECK-NEXT:    store i8 53, ptr [[P1]], align 1, !noalias [[META0]]
+; CHECK-NEXT:    store i8 54, ptr [[P2]], align 1, !noalias [[META8]]
 ; CHECK-NEXT:    br label [[COND_END]]
 ; CHECK:       cond.end:
-; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !alias.scope !6
-; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !alias.scope !0
-; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !alias.scope !8
-; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !noalias !6
-; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !noalias !0
-; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !noalias !8
+; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !alias.scope [[META6]]
+; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !alias.scope [[META0]]
+; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !alias.scope [[META8]]
+; CHECK-NEXT:    store i8 62, ptr [[P0]], align 1, !noalias [[META6]]
+; CHECK-NEXT:    store i8 63, ptr [[P1]], align 1, !noalias [[META0]]
+; CHECK-NEXT:    store i8 64, ptr [[P2]], align 1, !noalias [[META8]]
 ; CHECK-NEXT:    [[INC]] = add nuw i32 [[J_02]], 1
-; CHECK-NEXT:    br i1 undef, label [[FOR_COND_CLEANUP46_LOOPEXIT:%.*]], label [[FOR_BODY47]], [[LOOP9:!llvm.loop !.*]]
+; CHECK-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC]], [[N]]
+; CHECK-NEXT:    br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP46_LOOPEXIT:%.*]], label [[FOR_BODY47]], !llvm.loop [[LOOP9:![0-9]+]]
 ;
 for.body47.lr.ph:
   call void @llvm.experimental.noalias.scope.decl(metadata !5)
@@ -116,7 +117,7 @@ cond.end:                                         ; preds = %cond.true, %for.bod
   store i8 63, ptr %p1, !noalias !5
   store i8 64, ptr %p2, !noalias !7
   %inc = add nuw i32 %j.02, 1
-  %exitcond.not = icmp eq i32 %inc, undef
+  %exitcond.not = icmp eq i32 %inc, %n
   br i1 %exitcond.not, label %for.cond.cleanup46, label %for.body47, !llvm.loop !3
 }
 
diff --git a/llvm/test/Transforms/LoopUnroll/wrong_assert_in_peeling.ll b/llvm/test/Transforms/LoopUnroll/wrong_assert_in_peeling.ll
index 32f8baeb8d69fb..685d26292cc00a 100644
--- a/llvm/test/Transforms/LoopUnroll/wrong_assert_in_peeling.ll
+++ b/llvm/test/Transforms/LoopUnroll/wrong_assert_in_peeling.ll
@@ -3,7 +3,7 @@
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
 target triple = "x86_64-unknown-linux-gnu"
 
-define i32 @test() {
+define i32 @test(i32 %x, i8 %y) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    br label [[BB1:%.*]]
@@ -13,17 +13,17 @@ define i32 @test() {
 ; CHECK:       bb2.peel.begin:
 ; CHECK-NEXT:    br label [[BB2_PEEL:%.*]]
 ; CHECK:       bb2.peel:
-; CHECK-NEXT:    [[TMP4_PEEL:%.*]] = add nsw i32 undef, [[TMP]]
+; CHECK-NEXT:    [[TMP4_PEEL:%.*]] = add nsw i32 [[X:%.*]], [[TMP]]
 ; CHECK-NEXT:    br label [[BB5_PEEL:%.*]]
 ; CHECK:       bb5.peel:
-; CHECK-NEXT:    [[TMP6_PEEL:%.*]] = icmp eq i32 undef, 33
+; CHECK-NEXT:    [[TMP6_PEEL:%.*]] = icmp eq i32 [[X]], 33
 ; CHECK-NEXT:    br i1 [[TMP6_PEEL]], label [[BB7_PEEL:%.*]], label [[BB15_LOOPEXIT2:%.*]]
 ; CHECK:       bb7.peel:
-; CHECK-NEXT:    [[TMP8_PEEL:%.*]] = sub nsw i32 undef, undef
+; CHECK-NEXT:    [[TMP8_PEEL:%.*]] = sub nsw i32 [[X]], [[X]]
 ; CHECK-NEXT:    [[TMP9_PEEL:%.*]] = icmp eq i32 [[TMP8_PEEL]], 0
 ; CHECK-NEXT:    br i1 [[TMP9_PEEL]], label [[BB10_PEEL:%.*]], label [[BB10_PEEL]]
 ; CHECK:       bb10.peel:
-; CHECK-NEXT:    [[TMP11_PEEL:%.*]] = icmp eq i8 undef, 0
+; CHECK-NEXT:    [[TMP11_PEEL:%.*]] = icmp eq i8 [[Y:%.*]], 0
 ; CHECK-NEXT:    br i1 [[TMP11_PEEL]], label [[BB12_PEEL:%.*]], label [[BB17_LOOPEXIT3:%.*]]
 ; CHECK:       bb12.peel:
 ; CHECK-NEXT:    br i1 false, label [[BB13]], label [[BB2_PEEL_NEXT:%.*]]
@@ -38,11 +38,15 @@ define i32 @test() {
 ; CHECK-NEXT:    [[TMP4]] = add nsw i32 [[TMP3]], [[TMP]]
 ; CHECK-NEXT:    br label [[BB5:%.*]]
 ; CHECK:       bb5:
-; CHECK-NEXT:    br i1 undef, label [[BB7:%.*]], label [[BB15_LOOPEXIT:%.*]]
+; CHECK-NEXT:    [[TMP6:%.*]] = icmp eq i32 [[X]], 33
+; CHECK-NEXT:    br i1 [[TMP6]], label [[BB7:%.*]], label [[BB15_LOOPEXIT:%.*]]
 ; CHECK:       bb7:
-; CHECK-NEXT:    br i1 undef, label [[BB10:%.*]], label [[BB10]]
+; CHECK-NEXT:    [[TMP8:%.*]] = sub nsw i32 [[TMP3]], [[X]]
+; CHECK-NEXT:    [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 0
+; CHECK-NEXT:    br i1 [[TMP9]], label [[BB10:%.*]], label [[BB10]]
 ; CHECK:       bb10:
-; CHECK-NEXT:    br i1 undef, label [[BB12]], label [[BB17_LOOPEXIT:%.*]]
+; CHECK-NEXT:    [[TMP11:%.*]] = icmp eq i8 [[Y]], 0
+; CHECK-NEXT:    br i1 [[TMP11]], label [[BB12]], label [[BB17_LOOPEXIT:%.*]]
 ; CHECK:       bb12:
 ; CHECK-NEXT:    br i1 false, label [[BB13_LOOPEXIT:%.*]], label [[BB2]], !llvm.loop [[LOOP0:![0-9]+]]
 ; CHECK:       bb13.loopexit:
@@ -73,21 +77,21 @@ bb1:                                              ; preds = %bb13, %bb
   br label %bb2
 
 bb2:                                              ; preds = %bb12, %bb1
-  %tmp3 = phi i32 [ undef, %bb1 ], [ %tmp4, %bb12 ]
+  %tmp3 = phi i32 [ %x, %bb1 ], [ %tmp4, %bb12 ]
   %tmp4 = add nsw i32 %tmp3, %tmp
   br label %bb5
 
 bb5:                                              ; preds = %bb2
-  %tmp6 = icmp eq i32 undef, 33
+  %tmp6 = icmp eq i32 %x, 33
   br i1 %tmp6, label %bb7, label %bb15
 
 bb7:                                              ; preds = %bb5
-  %tmp8 = sub nsw i32 %tmp3, undef
+  %tmp8 = sub nsw i32 %tmp3, %x
   %tmp9 = icmp eq i32 %tmp8, 0
   br i1 %tmp9, label %bb10, label %bb10
 
 bb10:                                             ; preds = %bb7, %bb7
-  %tmp11 = icmp eq i8 undef, 0
+  %tmp11 = icmp eq i8 %y, 0
   br i1 %tmp11, label %bb12, label %bb17
 
 bb12:                                             ; preds = %bb10

>From 63b24a6b567eec8c3e8930455606eadecc1efe3d Mon Sep 17 00:00:00 2001
From: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: Fri, 13 Dec 2024 22:36:12 +0800
Subject: [PATCH 2/2] [InstSimplify] Replace undef with poison in tests. NFC.

---
 .../InstSimplify/{undef.ll => poison.ll}      | 128 +++++++++---------
 1 file changed, 64 insertions(+), 64 deletions(-)
 rename llvm/test/Transforms/InstSimplify/{undef.ll => poison.ll} (67%)

diff --git a/llvm/test/Transforms/InstSimplify/undef.ll b/llvm/test/Transforms/InstSimplify/poison.ll
similarity index 67%
rename from llvm/test/Transforms/InstSimplify/undef.ll
rename to llvm/test/Transforms/InstSimplify/poison.ll
index f821cf874f71fc..d72cd4e1d8ea17 100644
--- a/llvm/test/Transforms/InstSimplify/undef.ll
+++ b/llvm/test/Transforms/InstSimplify/poison.ll
@@ -3,89 +3,89 @@
 
 define i64 @test0() {
 ; CHECK-LABEL: @test0(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = mul i64 undef, undef
+  %r = mul i64 poison, poison
   ret i64 %r
 }
 
 define i64 @test1() {
 ; CHECK-LABEL: @test1(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = mul i64 3, undef
+  %r = mul i64 3, poison
   ret i64 %r
 }
 
 define i64 @test2() {
 ; CHECK-LABEL: @test2(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = mul i64 undef, 3
+  %r = mul i64 poison, 3
   ret i64 %r
 }
 
 define i64 @test3() {
 ; CHECK-LABEL: @test3(
-; CHECK-NEXT:    ret i64 0
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = mul i64 undef, 6
+  %r = mul i64 poison, 6
   ret i64 %r
 }
 
 define i64 @test4() {
 ; CHECK-LABEL: @test4(
-; CHECK-NEXT:    ret i64 0
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = mul i64 6, undef
+  %r = mul i64 6, poison
   ret i64 %r
 }
 
 define i64 @test5() {
 ; CHECK-LABEL: @test5(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = and i64 undef, undef
+  %r = and i64 poison, poison
   ret i64 %r
 }
 
 define i64 @test6() {
 ; CHECK-LABEL: @test6(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = or i64 undef, undef
+  %r = or i64 poison, poison
   ret i64 %r
 }
 
 define i64 @test7() {
 ; CHECK-LABEL: @test7(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = udiv i64 undef, 1
+  %r = udiv i64 poison, 1
   ret i64 %r
 }
 
 define i64 @test8() {
 ; CHECK-LABEL: @test8(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = sdiv i64 undef, 1
+  %r = sdiv i64 poison, 1
   ret i64 %r
 }
 
 define i64 @test9() {
 ; CHECK-LABEL: @test9(
-; CHECK-NEXT:    ret i64 0
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = urem i64 undef, 1
+  %r = urem i64 poison, 1
   ret i64 %r
 }
 
 define i64 @test10() {
 ; CHECK-LABEL: @test10(
-; CHECK-NEXT:    ret i64 0
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = srem i64 undef, 1
+  %r = srem i64 poison, 1
   ret i64 %r
 }
 
@@ -93,7 +93,7 @@ define i64 @test11() {
 ; CHECK-LABEL: @test11(
 ; CHECK-NEXT:    ret i64 poison
 ;
-  %r = shl i64 undef, undef
+  %r = shl i64 poison, poison
   ret i64 %r
 }
 
@@ -101,7 +101,7 @@ define i64 @test11b(i64 %a) {
 ; CHECK-LABEL: @test11b(
 ; CHECK-NEXT:    ret i64 poison
 ;
-  %r = shl i64 %a, undef
+  %r = shl i64 %a, poison
   ret i64 %r
 }
 
@@ -109,7 +109,7 @@ define i64 @test12() {
 ; CHECK-LABEL: @test12(
 ; CHECK-NEXT:    ret i64 poison
 ;
-  %r = ashr i64 undef, undef
+  %r = ashr i64 poison, poison
   ret i64 %r
 }
 
@@ -117,7 +117,7 @@ define i64 @test12b(i64 %a) {
 ; CHECK-LABEL: @test12b(
 ; CHECK-NEXT:    ret i64 poison
 ;
-  %r = ashr i64 %a, undef
+  %r = ashr i64 %a, poison
   ret i64 %r
 }
 
@@ -125,7 +125,7 @@ define i64 @test13() {
 ; CHECK-LABEL: @test13(
 ; CHECK-NEXT:    ret i64 poison
 ;
-  %r = lshr i64 undef, undef
+  %r = lshr i64 poison, poison
   ret i64 %r
 }
 
@@ -133,48 +133,48 @@ define i64 @test13b(i64 %a) {
 ; CHECK-LABEL: @test13b(
 ; CHECK-NEXT:    ret i64 poison
 ;
-  %r = lshr i64 %a, undef
+  %r = lshr i64 %a, poison
   ret i64 %r
 }
 
 define i1 @test14() {
 ; CHECK-LABEL: @test14(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
-  %r = icmp slt i64 undef, undef
+  %r = icmp slt i64 poison, poison
   ret i1 %r
 }
 
 define i1 @test15() {
 ; CHECK-LABEL: @test15(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
-  %r = icmp ult i64 undef, undef
+  %r = icmp ult i64 poison, poison
   ret i1 %r
 }
 
 define i64 @test16(i64 %a) {
 ; CHECK-LABEL: @test16(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = select i1 undef, i64 %a, i64 undef
+  %r = select i1 poison, i64 %a, i64 poison
   ret i64 %r
 }
 
 define i64 @test17(i64 %a) {
 ; CHECK-LABEL: @test17(
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
-  %r = select i1 undef, i64 undef, i64 %a
+  %r = select i1 poison, i64 poison, i64 %a
   ret i64 %r
 }
 
 define i64 @test18(i64 %a) {
 ; CHECK-LABEL: @test18(
-; CHECK-NEXT:    [[R:%.*]] = call i64 undef(i64 [[A:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = call i64 poison(i64 [[A:%.*]])
 ; CHECK-NEXT:    ret i64 poison
 ;
-  %r = call i64 (i64) undef(i64 %a)
+  %r = call i64 (i64) poison(i64 %a)
   ret i64 %r
 }
 
@@ -182,7 +182,7 @@ define <4 x i8> @test19(<4 x i8> %a) {
 ; CHECK-LABEL: @test19(
 ; CHECK-NEXT:    ret <4 x i8> poison
 ;
-  %b = shl <4 x i8> %a, <i8 8, i8 9, i8 undef, i8 -1>
+  %b = shl <4 x i8> %a, <i8 8, i8 9, i8 poison, i8 -1>
   ret <4 x i8> %b
 }
 
@@ -220,17 +220,17 @@ define <2 x i32> @test21vec(<2 x i32> %a) {
 
 define i32 @test22(i32 %a) {
 ; CHECK-LABEL: @test22(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = ashr exact i32 undef, %a
+  %b = ashr exact i32 poison, %a
   ret i32 %b
 }
 
 define i32 @test23(i32 %a) {
 ; CHECK-LABEL: @test23(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = lshr exact i32 undef, %a
+  %b = lshr exact i32 poison, %a
   ret i32 %b
 }
 
@@ -238,7 +238,7 @@ define i32 @test24() {
 ; CHECK-LABEL: @test24(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %b = udiv i32 undef, 0
+  %b = udiv i32 poison, 0
   ret i32 %b
 }
 
@@ -246,7 +246,7 @@ define i32 @test25() {
 ; CHECK-LABEL: @test25(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %b = lshr i32 0, undef
+  %b = lshr i32 0, poison
   ret i32 %b
 }
 
@@ -254,7 +254,7 @@ define i32 @test26() {
 ; CHECK-LABEL: @test26(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %b = ashr i32 0, undef
+  %b = ashr i32 0, poison
   ret i32 %b
 }
 
@@ -262,63 +262,63 @@ define i32 @test27() {
 ; CHECK-LABEL: @test27(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %b = shl i32 0, undef
+  %b = shl i32 0, poison
   ret i32 %b
 }
 
 define i32 @test28(i32 %a) {
 ; CHECK-LABEL: @test28(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = shl nsw i32 undef, %a
+  %b = shl nsw i32 poison, %a
   ret i32 %b
 }
 
 define i32 @test29(i32 %a) {
 ; CHECK-LABEL: @test29(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = shl nuw i32 undef, %a
+  %b = shl nuw i32 poison, %a
   ret i32 %b
 }
 
 define i32 @test30(i32 %a) {
 ; CHECK-LABEL: @test30(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = shl nsw nuw i32 undef, %a
+  %b = shl nsw nuw i32 poison, %a
   ret i32 %b
 }
 
 define i32 @test31(i32 %a) {
 ; CHECK-LABEL: @test31(
-; CHECK-NEXT:    ret i32 0
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = shl i32 undef, %a
+  %b = shl i32 poison, %a
   ret i32 %b
 }
 
 define i32 @test32(i32 %a) {
 ; CHECK-LABEL: @test32(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = shl i32 undef, 0
+  %b = shl i32 poison, 0
   ret i32 %b
 }
 
 define i32 @test33(i32 %a) {
 ; CHECK-LABEL: @test33(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = ashr i32 undef, 0
+  %b = ashr i32 poison, 0
   ret i32 %b
 }
 
 define i32 @test34(i32 %a) {
 ; CHECK-LABEL: @test34(
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
-  %b = lshr i32 undef, 0
+  %b = lshr i32 poison, 0
   ret i32 %b
 }
 
@@ -342,7 +342,7 @@ define i32 @test37() {
 ; CHECK-LABEL: @test37(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %b = udiv i32 undef, undef
+  %b = udiv i32 poison, poison
   ret i32 %b
 }
 
@@ -350,7 +350,7 @@ define i32 @test38(i32 %a) {
 ; CHECK-LABEL: @test38(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %b = udiv i32 %a, undef
+  %b = udiv i32 %a, poison
   ret i32 %b
 }
 
@@ -358,6 +358,6 @@ define i32 @test39() {
 ; CHECK-LABEL: @test39(
 ; CHECK-NEXT:    ret i32 poison
 ;
-  %b = udiv i32 0, undef
+  %b = udiv i32 0, poison
   ret i32 %b
 }



More information about the llvm-commits mailing list