diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/lib/Analysis/InstructionSimplify.cpp @@ -4385,16 +4385,16 @@ if (VecC && ValC && IdxC) return ConstantExpr::getInsertElement(VecC, ValC, IdxC); - // For fixed-length vector, fold into undef if index is out of bounds. + // For fixed-length vector, fold into poison if index is out of bounds. if (auto *CI = dyn_cast(Idx)) { if (isa(Vec->getType()) && CI->uge(cast(Vec->getType())->getNumElements())) - return UndefValue::get(Vec->getType()); + return PoisonValue::get(Vec->getType()); } // If index is undef, it might be out of bounds (see above case) if (Q.isUndefValue(Idx)) - return UndefValue::get(Vec->getType()); + return PoisonValue::get(Vec->getType()); // If the scalar is undef, and there is no risk of propagating poison from the // vector value, simplify to the vector value. diff --git a/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll b/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll --- a/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll +++ b/llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll @@ -34,7 +34,7 @@ define <4 x double> @inselt_bad_index(<4 x double> %a) { ; CHECK-LABEL: @inselt_bad_index( -; CHECK-NEXT: ret <4 x double> undef +; CHECK-NEXT: ret <4 x double> poison ; %I = insertelement <4 x double> %a, double 0.0, i64 4294967296 ret <4 x double> %I diff --git a/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle-inseltpoison.ll b/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle-inseltpoison.ll --- a/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle-inseltpoison.ll +++ b/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle-inseltpoison.ll @@ -57,7 +57,7 @@ ; Out of bounds index folds to undef define <4 x float> @bazzz(<4 x float> %x) { ; CHECK-LABEL: @bazzz( -; CHECK-NEXT: ret <4 x float> +; CHECK-NEXT: ret <4 x float> ; %ins1 = insertelement<4 x float> %x, float 1.0, i32 5 %ins2 = insertelement<4 x float> %ins1, float 2.0, i32 2 @@ -66,7 +66,7 @@ define <4 x float> @bazzzz(<4 x float> %x) { ; CHECK-LABEL: @bazzzz( -; CHECK-NEXT: ret <4 x float> +; CHECK-NEXT: ret <4 x float> ; %ins1 = insertelement<4 x float> %x, float 1.0, i32 undef %ins2 = insertelement<4 x float> %ins1, float 2.0, i32 2 diff --git a/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle.ll b/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle.ll --- a/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle.ll +++ b/llvm/test/Transforms/InstCombine/vector_insertelt_shuffle.ll @@ -57,7 +57,7 @@ ; Out of bounds index folds to undef define <4 x float> @bazzz(<4 x float> %x) { ; CHECK-LABEL: @bazzz( -; CHECK-NEXT: ret <4 x float> +; CHECK-NEXT: ret <4 x float> ; %ins1 = insertelement<4 x float> %x, float 1.0, i32 5 %ins2 = insertelement<4 x float> %ins1, float 2.0, i32 2 @@ -66,7 +66,7 @@ define <4 x float> @bazzzz(<4 x float> %x) { ; CHECK-LABEL: @bazzzz( -; CHECK-NEXT: ret <4 x float> +; CHECK-NEXT: ret <4 x float> ; %ins1 = insertelement<4 x float> %x, float 1.0, i32 undef %ins2 = insertelement<4 x float> %ins1, float 2.0, i32 2 diff --git a/llvm/test/Transforms/InstSimplify/insertelement.ll b/llvm/test/Transforms/InstSimplify/insertelement.ll --- a/llvm/test/Transforms/InstSimplify/insertelement.ll +++ b/llvm/test/Transforms/InstSimplify/insertelement.ll @@ -3,7 +3,7 @@ define <4 x i32> @test1(<4 x i32> %A) { ; CHECK-LABEL: @test1( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %I = insertelement <4 x i32> %A, i32 5, i64 4294967296 ret <4 x i32> %I @@ -11,7 +11,7 @@ define <4 x i32> @test2(<4 x i32> %A) { ; CHECK-LABEL: @test2( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %I = insertelement <4 x i32> %A, i32 5, i64 4 ret <4 x i32> %I @@ -28,7 +28,7 @@ define <4 x i32> @test4(<4 x i32> %A) { ; CHECK-LABEL: @test4( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %I = insertelement <4 x i32> %A, i32 5, i128 100 ret <4 x i32> %I @@ -36,7 +36,7 @@ define <4 x i32> @test5(<4 x i32> %A) { ; CHECK-LABEL: @test5( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %I = insertelement <4 x i32> %A, i32 5, i64 undef ret <4 x i32> %I @@ -44,7 +44,7 @@ define <4 x i32> @test5_poison(<4 x i32> %A) { ; CHECK-LABEL: @test5_poison( -; CHECK-NEXT: ret <4 x i32> undef +; CHECK-NEXT: ret <4 x i32> poison ; %I = insertelement <4 x i32> %A, i32 5, i64 poison ret <4 x i32> %I diff --git a/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll b/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll --- a/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll +++ b/llvm/test/Transforms/InstSimplify/vscale-inseltpoison.ll @@ -9,7 +9,7 @@ define @insertelement_idx_undef( %a) { ; CHECK-LABEL: @insertelement_idx_undef( -; CHECK-NEXT: ret undef +; CHECK-NEXT: ret poison ; %r = insertelement %a, i32 5, i64 undef ret %r diff --git a/llvm/test/Transforms/InstSimplify/vscale.ll b/llvm/test/Transforms/InstSimplify/vscale.ll --- a/llvm/test/Transforms/InstSimplify/vscale.ll +++ b/llvm/test/Transforms/InstSimplify/vscale.ll @@ -9,7 +9,7 @@ define @insertelement_idx_undef( %a) { ; CHECK-LABEL: @insertelement_idx_undef( -; CHECK-NEXT: ret undef +; CHECK-NEXT: ret poison ; %r = insertelement %a, i32 5, i64 undef ret %r @@ -133,8 +133,9 @@ define @cmp_le_smax_always_true( %x) { ; CHECK-LABEL: @cmp_le_smax_always_true( ; CHECK-NEXT: ret shufflevector ( insertelement ( undef, i1 true, i32 0), undef, zeroinitializer) - %cmp = icmp sle %x, shufflevector ( insertelement ( undef, i64 9223372036854775807, i32 0), undef, zeroinitializer) - ret %cmp +; + %cmp = icmp sle %x, shufflevector ( insertelement ( undef, i64 9223372036854775807, i32 0), undef, zeroinitializer) + ret %cmp } define @bitcast() {