[llvm-branch-commits] [llvm] 1fc992b - [Scalarizer] Use poison as insertelement's placeholder
Juneyoung Lee via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Jan 3 07:40:56 PST 2021
Author: Juneyoung Lee
Date: 2021-01-04T00:35:28+09:00
New Revision: 1fc992bd864aa7e73615a47e72e82e2cf7ac73ef
URL: https://github.com/llvm/llvm-project/commit/1fc992bd864aa7e73615a47e72e82e2cf7ac73ef
DIFF: https://github.com/llvm/llvm-project/commit/1fc992bd864aa7e73615a47e72e82e2cf7ac73ef.diff
LOG: [Scalarizer] Use poison as insertelement's placeholder
This patch makes Scalarizer to use poison as insertelement's placeholder.
It contains two changes in Scalarizer.cpp, and the both changes does not change the semantics of the optimized program.
It is because the placeholder value (poison) is already completely hidden by following insertelement instructions.
The first change at visitBitCastInst() creates poison vector of MidTy and consecutively inserts FanIn times,
which is # of elems of MidTy.
The second change at ScalarizerVisitor::finish() creates poison with Op->getType(), and it is filled with
Count insertelements.
The test diffs show that the poison value is never exposed after insertelements.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D93989
Added:
Modified:
llvm/lib/Transforms/Scalar/Scalarizer.cpp
llvm/test/Transforms/Scalarizer/basic-inseltpoison.ll
llvm/test/Transforms/Scalarizer/basic.ll
llvm/test/Transforms/Scalarizer/constant-insertelement.ll
llvm/test/Transforms/Scalarizer/intrinsics.ll
llvm/test/Transforms/Scalarizer/order-bug-inseltpoison.ll
llvm/test/Transforms/Scalarizer/order-bug.ll
llvm/test/Transforms/Scalarizer/scatter-order.ll
llvm/test/Transforms/Scalarizer/variable-extractelement.ll
llvm/test/Transforms/Scalarizer/variable-insertelement.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/Scalarizer.cpp b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
index c7fe21f2a3da..c95984fe198f 100644
--- a/llvm/lib/Transforms/Scalar/Scalarizer.cpp
+++ b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
@@ -733,7 +733,7 @@ bool ScalarizerVisitor::visitBitCastInst(BitCastInst &BCI) {
auto *MidTy = FixedVectorType::get(SrcVT->getElementType(), FanIn);
unsigned Op0I = 0;
for (unsigned ResI = 0; ResI < DstNumElems; ++ResI) {
- Value *V = UndefValue::get(MidTy);
+ Value *V = PoisonValue::get(MidTy);
for (unsigned MidI = 0; MidI < FanIn; ++MidI)
V = Builder.CreateInsertElement(V, Op0[Op0I++], Builder.getInt32(MidI),
BCI.getName() + ".i" + Twine(ResI)
@@ -932,7 +932,7 @@ bool ScalarizerVisitor::finish() {
if (!Op->use_empty()) {
// The value is still needed, so recreate it using a series of
// InsertElements.
- Value *Res = UndefValue::get(Op->getType());
+ Value *Res = PoisonValue::get(Op->getType());
if (auto *Ty = dyn_cast<VectorType>(Op->getType())) {
BasicBlock *BB = Op->getParent();
unsigned Count = cast<FixedVectorType>(Ty)->getNumElements();
diff --git a/llvm/test/Transforms/Scalarizer/basic-inseltpoison.ll b/llvm/test/Transforms/Scalarizer/basic-inseltpoison.ll
index d785764e3366..2b501cfd0a7e 100644
--- a/llvm/test/Transforms/Scalarizer/basic-inseltpoison.ll
+++ b/llvm/test/Transforms/Scalarizer/basic-inseltpoison.ll
@@ -33,7 +33,7 @@ define void @f1(<4 x float> %init, <4 x float> *%base, i32 %count) {
; CHECK: %add.i1 = fadd float %val.i1, %val.i3
; CHECK: %add.i2 = fadd float %acc.i0, %acc.i2
; CHECK: %add.i3 = fadd float %acc.i1, %acc.i3
-; CHECK: %add.upto0 = insertelement <4 x float> undef, float %add.i0, i32 0
+; CHECK: %add.upto0 = insertelement <4 x float> poison, float %add.i0, i32 0
; CHECK: %add.upto1 = insertelement <4 x float> %add.upto0, float %add.i1, i32 1
; CHECK: %add.upto2 = insertelement <4 x float> %add.upto1, float %add.i2, i32 2
; CHECK: %add = insertelement <4 x float> %add.upto2, float %add.i3, i32 3
@@ -247,7 +247,7 @@ define <4 x float> @f6(<4 x float> %x) {
; CHECK: %res.i2 = fadd float %x.i2, 3.0{{[e+0]*}}, !fpmath ![[TAG]]
; CHECK: %x.i3 = extractelement <4 x float> %x, i32 3
; CHECK: %res.i3 = fadd float %x.i3, 4.0{{[e+0]*}}, !fpmath ![[TAG]]
-; CHECK: %res.upto0 = insertelement <4 x float> undef, float %res.i0, i32 0
+; CHECK: %res.upto0 = insertelement <4 x float> poison, float %res.i0, i32 0
; CHECK: %res.upto1 = insertelement <4 x float> %res.upto0, float %res.i1, i32 1
; CHECK: %res.upto2 = insertelement <4 x float> %res.upto1, float %res.i2, i32 2
; CHECK: %res = insertelement <4 x float> %res.upto2, float %res.i3, i32 3
@@ -403,7 +403,7 @@ define <4 x float> @f14(<4 x float> %acc, i32 %count) {
; CHECK: %this_acc.i2 = phi float [ %acc.i2, %entry ], [ %next_acc.i2, %loop ]
; CHECK: %this_acc.i3 = phi float [ %acc.i3, %entry ], [ %next_acc.i3, %loop ]
; CHECK: %this_count = phi i32 [ %count, %entry ], [ %next_count, %loop ]
-; CHECK: %this_acc.upto0 = insertelement <4 x float> undef, float %this_acc.i0, i32 0
+; CHECK: %this_acc.upto0 = insertelement <4 x float> poison, float %this_acc.i0, i32 0
; CHECK: %this_acc.upto1 = insertelement <4 x float> %this_acc.upto0, float %this_acc.i1, i32 1
; CHECK: %this_acc.upto2 = insertelement <4 x float> %this_acc.upto1, float %this_acc.i2, i32 2
; CHECK: %this_acc = insertelement <4 x float> %this_acc.upto2, float %this_acc.i3, i32 3
@@ -440,7 +440,7 @@ define void @f15(<4 x float> %init, <4 x float> *%base, i32 %count) {
; CHECK: %neg.i1 = fneg float %val.i1
; CHECK: %neg.i2 = fneg float %val.i2
; CHECK: %neg.i3 = fneg float %val.i3
-; CHECK: %neg.upto0 = insertelement <4 x float> undef, float %neg.i0, i32 0
+; CHECK: %neg.upto0 = insertelement <4 x float> poison, float %neg.i0, i32 0
; CHECK: %neg.upto1 = insertelement <4 x float> %neg.upto0, float %neg.i1, i32 1
; CHECK: %neg.upto2 = insertelement <4 x float> %neg.upto1, float %neg.i2, i32 2
; CHECK: %neg = insertelement <4 x float> %neg.upto2, float %neg.i3, i32 3
@@ -543,7 +543,7 @@ define <2 x float> @f22(<2 x float> %x, <2 x float> %y, <2 x float> %z) {
define <2 x i32> @f23_crash(<2 x i32> %srcvec, i32 %v1) {
; CHECK-LABEL: @f23_crash(
; CHECK: %v0 = extractelement <2 x i32> %srcvec, i32 0
-; CHECK: %t1.upto0 = insertelement <2 x i32> undef, i32 %v0, i32 0
+; CHECK: %t1.upto0 = insertelement <2 x i32> poison, i32 %v0, i32 0
; CHECK: %t1 = insertelement <2 x i32> %t1.upto0, i32 %v1, i32 1
; CHECK: ret <2 x i32> %t1
%v0 = extractelement <2 x i32> %srcvec, i32 0
diff --git a/llvm/test/Transforms/Scalarizer/basic.ll b/llvm/test/Transforms/Scalarizer/basic.ll
index c8295346b206..419aa0cfd00a 100644
--- a/llvm/test/Transforms/Scalarizer/basic.ll
+++ b/llvm/test/Transforms/Scalarizer/basic.ll
@@ -33,7 +33,7 @@ define void @f1(<4 x float> %init, <4 x float> *%base, i32 %count) {
; CHECK: %add.i1 = fadd float %val.i1, %val.i3
; CHECK: %add.i2 = fadd float %acc.i0, %acc.i2
; CHECK: %add.i3 = fadd float %acc.i1, %acc.i3
-; CHECK: %add.upto0 = insertelement <4 x float> undef, float %add.i0, i32 0
+; CHECK: %add.upto0 = insertelement <4 x float> poison, float %add.i0, i32 0
; CHECK: %add.upto1 = insertelement <4 x float> %add.upto0, float %add.i1, i32 1
; CHECK: %add.upto2 = insertelement <4 x float> %add.upto1, float %add.i2, i32 2
; CHECK: %add = insertelement <4 x float> %add.upto2, float %add.i3, i32 3
@@ -247,7 +247,7 @@ define <4 x float> @f6(<4 x float> %x) {
; CHECK: %res.i2 = fadd float %x.i2, 3.0{{[e+0]*}}, !fpmath ![[TAG]]
; CHECK: %x.i3 = extractelement <4 x float> %x, i32 3
; CHECK: %res.i3 = fadd float %x.i3, 4.0{{[e+0]*}}, !fpmath ![[TAG]]
-; CHECK: %res.upto0 = insertelement <4 x float> undef, float %res.i0, i32 0
+; CHECK: %res.upto0 = insertelement <4 x float> poison, float %res.i0, i32 0
; CHECK: %res.upto1 = insertelement <4 x float> %res.upto0, float %res.i1, i32 1
; CHECK: %res.upto2 = insertelement <4 x float> %res.upto1, float %res.i2, i32 2
; CHECK: %res = insertelement <4 x float> %res.upto2, float %res.i3, i32 3
@@ -403,7 +403,7 @@ define <4 x float> @f14(<4 x float> %acc, i32 %count) {
; CHECK: %this_acc.i2 = phi float [ %acc.i2, %entry ], [ %next_acc.i2, %loop ]
; CHECK: %this_acc.i3 = phi float [ %acc.i3, %entry ], [ %next_acc.i3, %loop ]
; CHECK: %this_count = phi i32 [ %count, %entry ], [ %next_count, %loop ]
-; CHECK: %this_acc.upto0 = insertelement <4 x float> undef, float %this_acc.i0, i32 0
+; CHECK: %this_acc.upto0 = insertelement <4 x float> poison, float %this_acc.i0, i32 0
; CHECK: %this_acc.upto1 = insertelement <4 x float> %this_acc.upto0, float %this_acc.i1, i32 1
; CHECK: %this_acc.upto2 = insertelement <4 x float> %this_acc.upto1, float %this_acc.i2, i32 2
; CHECK: %this_acc = insertelement <4 x float> %this_acc.upto2, float %this_acc.i3, i32 3
@@ -440,7 +440,7 @@ define void @f15(<4 x float> %init, <4 x float> *%base, i32 %count) {
; CHECK: %neg.i1 = fneg float %val.i1
; CHECK: %neg.i2 = fneg float %val.i2
; CHECK: %neg.i3 = fneg float %val.i3
-; CHECK: %neg.upto0 = insertelement <4 x float> undef, float %neg.i0, i32 0
+; CHECK: %neg.upto0 = insertelement <4 x float> poison, float %neg.i0, i32 0
; CHECK: %neg.upto1 = insertelement <4 x float> %neg.upto0, float %neg.i1, i32 1
; CHECK: %neg.upto2 = insertelement <4 x float> %neg.upto1, float %neg.i2, i32 2
; CHECK: %neg = insertelement <4 x float> %neg.upto2, float %neg.i3, i32 3
@@ -543,7 +543,7 @@ define <2 x float> @f22(<2 x float> %x, <2 x float> %y, <2 x float> %z) {
define <2 x i32> @f23_crash(<2 x i32> %srcvec, i32 %v1) {
; CHECK-LABEL: @f23_crash(
; CHECK: %v0 = extractelement <2 x i32> %srcvec, i32 0
-; CHECK: %t1.upto0 = insertelement <2 x i32> undef, i32 %v0, i32 0
+; CHECK: %t1.upto0 = insertelement <2 x i32> poison, i32 %v0, i32 0
; CHECK: %t1 = insertelement <2 x i32> %t1.upto0, i32 %v1, i32 1
; CHECK: ret <2 x i32> %t1
%v0 = extractelement <2 x i32> %srcvec, i32 0
diff --git a/llvm/test/Transforms/Scalarizer/constant-insertelement.ll b/llvm/test/Transforms/Scalarizer/constant-insertelement.ll
index 4ddde3598334..7bb659aff352 100644
--- a/llvm/test/Transforms/Scalarizer/constant-insertelement.ll
+++ b/llvm/test/Transforms/Scalarizer/constant-insertelement.ll
@@ -16,7 +16,7 @@ define <4 x i32> @f1(<4 x i32> *%src, i32 %repl, i32 %index) {
; ALL-NEXT: [[VAL2_I1:%.*]] = shl i32 2, [[VAL0_I1]]
; ALL-NEXT: [[VAL2_I2:%.*]] = shl i32 3, [[VAL0_I2]]
; ALL-NEXT: [[VAL2_I3:%.*]] = shl i32 4, [[REPL:%.*]]
-; ALL-NEXT: [[VAL2_UPTO0:%.*]] = insertelement <4 x i32> undef, i32 [[VAL2_I0]], i32 0
+; ALL-NEXT: [[VAL2_UPTO0:%.*]] = insertelement <4 x i32> poison, i32 [[VAL2_I0]], i32 0
; ALL-NEXT: [[VAL2_UPTO1:%.*]] = insertelement <4 x i32> [[VAL2_UPTO0]], i32 [[VAL2_I1]], i32 1
; ALL-NEXT: [[VAL2_UPTO2:%.*]] = insertelement <4 x i32> [[VAL2_UPTO1]], i32 [[VAL2_I2]], i32 2
; ALL-NEXT: [[VAL2:%.*]] = insertelement <4 x i32> [[VAL2_UPTO2]], i32 [[VAL2_I3]], i32 3
diff --git a/llvm/test/Transforms/Scalarizer/intrinsics.ll b/llvm/test/Transforms/Scalarizer/intrinsics.ll
index b277a5bf355f..c42eb6761009 100644
--- a/llvm/test/Transforms/Scalarizer/intrinsics.ll
+++ b/llvm/test/Transforms/Scalarizer/intrinsics.ll
@@ -29,7 +29,7 @@ declare <2 x i32> @llvm.umul.fix.sat.v2i32(<2 x i32>, <2 x i32>, i32)
; CHECK-LABEL: @scalarize_sqrt_v2f32(
; CHECK: %sqrt.i0 = call float @llvm.sqrt.f32(float %x.i0)
; CHECK: %sqrt.i1 = call float @llvm.sqrt.f32(float %x.i1)
-; CHECK: %sqrt.upto0 = insertelement <2 x float> undef, float %sqrt.i0, i32 0
+; CHECK: %sqrt.upto0 = insertelement <2 x float> poison, float %sqrt.i0, i32 0
; CHECK: %sqrt = insertelement <2 x float> %sqrt.upto0, float %sqrt.i1, i32 1
; CHECK: ret <2 x float> %sqrt
define <2 x float> @scalarize_sqrt_v2f32(<2 x float> %x) #0 {
@@ -40,7 +40,7 @@ define <2 x float> @scalarize_sqrt_v2f32(<2 x float> %x) #0 {
; CHECK-LABEL: @scalarize_minnum_v2f32(
; CHECK: %minnum.i0 = call float @llvm.minnum.f32(float %x.i0, float %y.i0)
; CHECK: %minnum.i1 = call float @llvm.minnum.f32(float %x.i1, float %y.i1)
-; CHECK: %minnum.upto0 = insertelement <2 x float> undef, float %minnum.i0, i32 0
+; CHECK: %minnum.upto0 = insertelement <2 x float> poison, float %minnum.i0, i32 0
; CHECK: %minnum = insertelement <2 x float> %minnum.upto0, float %minnum.i1, i32 1
; CHECK: ret <2 x float> %minnum
define <2 x float> @scalarize_minnum_v2f32(<2 x float> %x, <2 x float> %y) #0 {
@@ -51,7 +51,7 @@ define <2 x float> @scalarize_minnum_v2f32(<2 x float> %x, <2 x float> %y) #0 {
; CHECK-LABEL: @scalarize_minimum_v2f32(
; CHECK: %minimum.i0 = call float @llvm.minimum.f32(float %x.i0, float %y.i0)
; CHECK: %minimum.i1 = call float @llvm.minimum.f32(float %x.i1, float %y.i1)
-; CHECK: %minimum.upto0 = insertelement <2 x float> undef, float %minimum.i0, i32 0
+; CHECK: %minimum.upto0 = insertelement <2 x float> poison, float %minimum.i0, i32 0
; CHECK: %minimum = insertelement <2 x float> %minimum.upto0, float %minimum.i1, i32 1
; CHECK: ret <2 x float> %minimum
define <2 x float> @scalarize_minimum_v2f32(<2 x float> %x, <2 x float> %y) #0 {
@@ -62,7 +62,7 @@ define <2 x float> @scalarize_minimum_v2f32(<2 x float> %x, <2 x float> %y) #0 {
; CHECK-LABEL: @scalarize_maximum_v2f32(
; CHECK: %maximum.i0 = call float @llvm.maximum.f32(float %x.i0, float %y.i0)
; CHECK: %maximum.i1 = call float @llvm.maximum.f32(float %x.i1, float %y.i1)
-; CHECK: %maximum.upto0 = insertelement <2 x float> undef, float %maximum.i0, i32 0
+; CHECK: %maximum.upto0 = insertelement <2 x float> poison, float %maximum.i0, i32 0
; CHECK: %maximum = insertelement <2 x float> %maximum.upto0, float %maximum.i1, i32 1
; CHECK: ret <2 x float> %maximum
define <2 x float> @scalarize_maximum_v2f32(<2 x float> %x, <2 x float> %y) #0 {
@@ -73,7 +73,7 @@ define <2 x float> @scalarize_maximum_v2f32(<2 x float> %x, <2 x float> %y) #0 {
; CHECK-LABEL: @scalarize_fma_v2f32(
; CHECK: %fma.i0 = call float @llvm.fma.f32(float %x.i0, float %y.i0, float %z.i0)
; CHECK: %fma.i1 = call float @llvm.fma.f32(float %x.i1, float %y.i1, float %z.i1)
-; CHECK: %fma.upto0 = insertelement <2 x float> undef, float %fma.i0, i32 0
+; CHECK: %fma.upto0 = insertelement <2 x float> poison, float %fma.i0, i32 0
; CHECK: %fma = insertelement <2 x float> %fma.upto0, float %fma.i1, i32 1
; CHECK: ret <2 x float> %fma
define <2 x float> @scalarize_fma_v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %z) #0 {
@@ -84,7 +84,7 @@ define <2 x float> @scalarize_fma_v2f32(<2 x float> %x, <2 x float> %y, <2 x flo
; CHECK-LABEL: @scalarize_bswap_v2i32(
; CHECK: %bswap.i0 = call i32 @llvm.bswap.i32(i32 %x.i0)
; CHECK: %bswap.i1 = call i32 @llvm.bswap.i32(i32 %x.i1)
-; CHECK: %bswap.upto0 = insertelement <2 x i32> undef, i32 %bswap.i0, i32 0
+; CHECK: %bswap.upto0 = insertelement <2 x i32> poison, i32 %bswap.i0, i32 0
; CHECK: %bswap = insertelement <2 x i32> %bswap.upto0, i32 %bswap.i1, i32 1
; CHECK: ret <2 x i32> %bswap
define <2 x i32> @scalarize_bswap_v2i32(<2 x i32> %x) #0 {
@@ -95,7 +95,7 @@ define <2 x i32> @scalarize_bswap_v2i32(<2 x i32> %x) #0 {
; CHECK-LABEL: @scalarize_ctlz_v2i32(
; CHECK: %ctlz.i0 = call i32 @llvm.ctlz.i32(i32 %x.i0, i1 true)
; CHECK: %ctlz.i1 = call i32 @llvm.ctlz.i32(i32 %x.i1, i1 true)
-; CHECK: %ctlz.upto0 = insertelement <2 x i32> undef, i32 %ctlz.i0, i32 0
+; CHECK: %ctlz.upto0 = insertelement <2 x i32> poison, i32 %ctlz.i0, i32 0
; CHECK: %ctlz = insertelement <2 x i32> %ctlz.upto0, i32 %ctlz.i1, i32 1
; CHECK: ret <2 x i32> %ctlz
define <2 x i32> @scalarize_ctlz_v2i32(<2 x i32> %x) #0 {
@@ -106,7 +106,7 @@ define <2 x i32> @scalarize_ctlz_v2i32(<2 x i32> %x) #0 {
; CHECK-LABEL: @scalarize_powi_v2f32(
; CHECK: %powi.i0 = call float @llvm.powi.f32(float %x.i0, i32 %y)
; CHECK: %powi.i1 = call float @llvm.powi.f32(float %x.i1, i32 %y)
-; CHECK: %powi.upto0 = insertelement <2 x float> undef, float %powi.i0, i32 0
+; CHECK: %powi.upto0 = insertelement <2 x float> poison, float %powi.i0, i32 0
; CHECK: %powi = insertelement <2 x float> %powi.upto0, float %powi.i1, i32 1
; CHECK: ret <2 x float> %powi
define <2 x float> @scalarize_powi_v2f32(<2 x float> %x, i32 %y) #0 {
@@ -117,7 +117,7 @@ define <2 x float> @scalarize_powi_v2f32(<2 x float> %x, i32 %y) #0 {
; CHECK-LABEL: @scalarize_smul_fix_sat_v2i32(
; CHECK: %smulfixsat.i0 = call i32 @llvm.smul.fix.sat.i32(i32 %x.i0, i32 5, i32 31)
; CHECK: %smulfixsat.i1 = call i32 @llvm.smul.fix.sat.i32(i32 %x.i1, i32 19, i32 31)
-; CHECK: %smulfixsat.upto0 = insertelement <2 x i32> undef, i32 %smulfixsat.i0, i32 0
+; CHECK: %smulfixsat.upto0 = insertelement <2 x i32> poison, i32 %smulfixsat.i0, i32 0
; CHECK: %smulfixsat = insertelement <2 x i32> %smulfixsat.upto0, i32 %smulfixsat.i1, i32 1
; CHECK: ret <2 x i32> %smulfixsat
define <2 x i32> @scalarize_smul_fix_sat_v2i32(<2 x i32> %x) #0 {
@@ -128,7 +128,7 @@ define <2 x i32> @scalarize_smul_fix_sat_v2i32(<2 x i32> %x) #0 {
; CHECK-LABEL: @scalarize_umul_fix_sat_v2i32(
; CHECK: %umulfixsat.i0 = call i32 @llvm.umul.fix.sat.i32(i32 %x.i0, i32 5, i32 31)
; CHECK: %umulfixsat.i1 = call i32 @llvm.umul.fix.sat.i32(i32 %x.i1, i32 19, i32 31)
-; CHECK: %umulfixsat.upto0 = insertelement <2 x i32> undef, i32 %umulfixsat.i0, i32 0
+; CHECK: %umulfixsat.upto0 = insertelement <2 x i32> poison, i32 %umulfixsat.i0, i32 0
; CHECK: %umulfixsat = insertelement <2 x i32> %umulfixsat.upto0, i32 %umulfixsat.i1, i32 1
; CHECK: ret <2 x i32> %umulfixsat
define <2 x i32> @scalarize_umul_fix_sat_v2i32(<2 x i32> %x) #0 {
diff --git a/llvm/test/Transforms/Scalarizer/order-bug-inseltpoison.ll b/llvm/test/Transforms/Scalarizer/order-bug-inseltpoison.ll
index eb1ca57ebedf..2ebd035ec492 100644
--- a/llvm/test/Transforms/Scalarizer/order-bug-inseltpoison.ll
+++ b/llvm/test/Transforms/Scalarizer/order-bug-inseltpoison.ll
@@ -10,7 +10,7 @@ entry:
br label %z
y:
-; CHECK: %f.upto0 = insertelement <4 x i32> undef, i32 %b.i0, i32 0
+; CHECK: %f.upto0 = insertelement <4 x i32> poison, i32 %b.i0, i32 0
; CHECK: %f.upto1 = insertelement <4 x i32> %f.upto0, i32 %b.i0, i32 1
; CHECK: %f.upto2 = insertelement <4 x i32> %f.upto1, i32 %b.i0, i32 2
; CHECK: %f = insertelement <4 x i32> %f.upto2, i32 %b.i0, i32 3
diff --git a/llvm/test/Transforms/Scalarizer/order-bug.ll b/llvm/test/Transforms/Scalarizer/order-bug.ll
index 1265bb07bf17..1bc069d55b8e 100644
--- a/llvm/test/Transforms/Scalarizer/order-bug.ll
+++ b/llvm/test/Transforms/Scalarizer/order-bug.ll
@@ -10,7 +10,7 @@ entry:
br label %z
y:
-; CHECK: %f.upto0 = insertelement <4 x i32> undef, i32 %b.i0, i32 0
+; CHECK: %f.upto0 = insertelement <4 x i32> poison, i32 %b.i0, i32 0
; CHECK: %f.upto1 = insertelement <4 x i32> %f.upto0, i32 %b.i0, i32 1
; CHECK: %f.upto2 = insertelement <4 x i32> %f.upto1, i32 %b.i0, i32 2
; CHECK: %f = insertelement <4 x i32> %f.upto2, i32 %b.i0, i32 3
diff --git a/llvm/test/Transforms/Scalarizer/scatter-order.ll b/llvm/test/Transforms/Scalarizer/scatter-order.ll
index df072abae53e..23967f41978f 100644
--- a/llvm/test/Transforms/Scalarizer/scatter-order.ll
+++ b/llvm/test/Transforms/Scalarizer/scatter-order.ll
@@ -18,7 +18,7 @@ define <2 x i32> @test1(i1 %b, <2 x i32> %i, <2 x i32> %j) {
; CHECK-NEXT: [[I_I1:%.*]] = extractelement <2 x i32> [[I]], i32 1
; CHECK-NEXT: [[J_I1:%.*]] = extractelement <2 x i32> [[J]], i32 1
; CHECK-NEXT: [[RES_I1:%.*]] = select i1 [[B]], i32 [[I_I1]], i32 [[J_I1]]
-; CHECK-NEXT: [[RES_UPTO0:%.*]] = insertelement <2 x i32> undef, i32 [[RES_I0]], i32 0
+; CHECK-NEXT: [[RES_UPTO0:%.*]] = insertelement <2 x i32> poison, i32 [[RES_I0]], i32 0
; CHECK-NEXT: [[RES:%.*]] = insertelement <2 x i32> [[RES_UPTO0]], i32 [[RES_I1]], i32 1
; CHECK-NEXT: ret <2 x i32> [[RES]]
;
@@ -36,7 +36,7 @@ define <2 x i32> @test2(<2 x i1> %b, <2 x i32> %i, <2 x i32> %j) {
; CHECK-NEXT: [[I_I1:%.*]] = extractelement <2 x i32> [[I]], i32 1
; CHECK-NEXT: [[J_I1:%.*]] = extractelement <2 x i32> [[J]], i32 1
; CHECK-NEXT: [[RES_I1:%.*]] = select i1 [[B_I1]], i32 [[I_I1]], i32 [[J_I1]]
-; CHECK-NEXT: [[RES_UPTO0:%.*]] = insertelement <2 x i32> undef, i32 [[RES_I0]], i32 0
+; CHECK-NEXT: [[RES_UPTO0:%.*]] = insertelement <2 x i32> poison, i32 [[RES_I0]], i32 0
; CHECK-NEXT: [[RES:%.*]] = insertelement <2 x i32> [[RES_UPTO0]], i32 [[RES_I1]], i32 1
; CHECK-NEXT: ret <2 x i32> [[RES]]
;
@@ -52,7 +52,7 @@ define <2 x i32> @test3(<2 x i32> %i, <2 x i32> %j) {
; CHECK-NEXT: [[I_I1:%.*]] = extractelement <2 x i32> [[I]], i32 1
; CHECK-NEXT: [[J_I1:%.*]] = extractelement <2 x i32> [[J]], i32 1
; CHECK-NEXT: [[RES_I1:%.*]] = add nuw nsw i32 [[I_I1]], [[J_I1]]
-; CHECK-NEXT: [[RES_UPTO0:%.*]] = insertelement <2 x i32> undef, i32 [[RES_I0]], i32 0
+; CHECK-NEXT: [[RES_UPTO0:%.*]] = insertelement <2 x i32> poison, i32 [[RES_I0]], i32 0
; CHECK-NEXT: [[RES:%.*]] = insertelement <2 x i32> [[RES_UPTO0]], i32 [[RES_I1]], i32 1
; CHECK-NEXT: ret <2 x i32> [[RES]]
;
diff --git a/llvm/test/Transforms/Scalarizer/variable-extractelement.ll b/llvm/test/Transforms/Scalarizer/variable-extractelement.ll
index 16a124243ea7..5e922d530f84 100644
--- a/llvm/test/Transforms/Scalarizer/variable-extractelement.ll
+++ b/llvm/test/Transforms/Scalarizer/variable-extractelement.ll
@@ -61,7 +61,7 @@ define i32 @f2(<4 x i32> *%src, i32 %index) {
; OFF-NEXT: [[VAL1_I2:%.*]] = shl i32 3, [[VAL0_I2]]
; OFF-NEXT: [[VAL0_I3:%.*]] = extractelement <4 x i32> [[VAL0]], i32 3
; OFF-NEXT: [[VAL1_I3:%.*]] = shl i32 4, [[VAL0_I3]]
-; OFF-NEXT: [[VAL1_UPTO0:%.*]] = insertelement <4 x i32> undef, i32 [[VAL1_I0]], i32 0
+; OFF-NEXT: [[VAL1_UPTO0:%.*]] = insertelement <4 x i32> poison, i32 [[VAL1_I0]], i32 0
; OFF-NEXT: [[VAL1_UPTO1:%.*]] = insertelement <4 x i32> [[VAL1_UPTO0]], i32 [[VAL1_I1]], i32 1
; OFF-NEXT: [[VAL1_UPTO2:%.*]] = insertelement <4 x i32> [[VAL1_UPTO1]], i32 [[VAL1_I2]], i32 2
; OFF-NEXT: [[VAL1:%.*]] = insertelement <4 x i32> [[VAL1_UPTO2]], i32 [[VAL1_I3]], i32 3
diff --git a/llvm/test/Transforms/Scalarizer/variable-insertelement.ll b/llvm/test/Transforms/Scalarizer/variable-insertelement.ll
index cb6663bccab2..6c8b49ecf148 100644
--- a/llvm/test/Transforms/Scalarizer/variable-insertelement.ll
+++ b/llvm/test/Transforms/Scalarizer/variable-insertelement.ll
@@ -20,7 +20,7 @@ define <4 x i32> @f1(<4 x i32> %src, i32 %val, i32 %index) {
; DEFAULT-NEXT: [[INDEX_IS_3:%.*]] = icmp eq i32 [[INDEX]], 3
; DEFAULT-NEXT: [[SRC_I3:%.*]] = extractelement <4 x i32> [[SRC]], i32 3
; DEFAULT-NEXT: [[RES_I3:%.*]] = select i1 [[INDEX_IS_3]], i32 [[VAL]], i32 [[SRC_I3]]
-; DEFAULT-NEXT: [[RES_UPTO0:%.*]] = insertelement <4 x i32> undef, i32 [[RES_I0]], i32 0
+; DEFAULT-NEXT: [[RES_UPTO0:%.*]] = insertelement <4 x i32> poison, i32 [[RES_I0]], i32 0
; DEFAULT-NEXT: [[RES_UPTO1:%.*]] = insertelement <4 x i32> [[RES_UPTO0]], i32 [[RES_I1]], i32 1
; DEFAULT-NEXT: [[RES_UPTO2:%.*]] = insertelement <4 x i32> [[RES_UPTO1]], i32 [[RES_I2]], i32 2
; DEFAULT-NEXT: [[RES:%.*]] = insertelement <4 x i32> [[RES_UPTO2]], i32 [[RES_I3]], i32 3
@@ -53,7 +53,7 @@ define void @f2(<4 x i32> *%dest, <4 x i32> *%src, i32 %index) {
; DEFAULT-NEXT: [[VAL2_I1:%.*]] = shl i32 2, [[VAL1_I1]]
; DEFAULT-NEXT: [[VAL2_I2:%.*]] = shl i32 3, [[VAL1_I2]]
; DEFAULT-NEXT: [[VAL2_I3:%.*]] = shl i32 4, [[VAL1_I3]]
-; DEFAULT-NEXT: [[VAL2_UPTO0:%.*]] = insertelement <4 x i32> undef, i32 [[VAL2_I0]], i32 0
+; DEFAULT-NEXT: [[VAL2_UPTO0:%.*]] = insertelement <4 x i32> poison, i32 [[VAL2_I0]], i32 0
; DEFAULT-NEXT: [[VAL2_UPTO1:%.*]] = insertelement <4 x i32> [[VAL2_UPTO0]], i32 [[VAL2_I1]], i32 1
; DEFAULT-NEXT: [[VAL2_UPTO2:%.*]] = insertelement <4 x i32> [[VAL2_UPTO1]], i32 [[VAL2_I2]], i32 2
; DEFAULT-NEXT: [[VAL2:%.*]] = insertelement <4 x i32> [[VAL2_UPTO2]], i32 [[VAL2_I3]], i32 3
@@ -71,7 +71,7 @@ define void @f2(<4 x i32> *%dest, <4 x i32> *%src, i32 %index) {
; OFF-NEXT: [[VAL2_I2:%.*]] = shl i32 3, [[VAL1_I2]]
; OFF-NEXT: [[VAL1_I3:%.*]] = extractelement <4 x i32> [[VAL1]], i32 3
; OFF-NEXT: [[VAL2_I3:%.*]] = shl i32 4, [[VAL1_I3]]
-; OFF-NEXT: [[VAL2_UPTO0:%.*]] = insertelement <4 x i32> undef, i32 [[VAL2_I0]], i32 0
+; OFF-NEXT: [[VAL2_UPTO0:%.*]] = insertelement <4 x i32> poison, i32 [[VAL2_I0]], i32 0
; OFF-NEXT: [[VAL2_UPTO1:%.*]] = insertelement <4 x i32> [[VAL2_UPTO0]], i32 [[VAL2_I1]], i32 1
; OFF-NEXT: [[VAL2_UPTO2:%.*]] = insertelement <4 x i32> [[VAL2_UPTO1]], i32 [[VAL2_I2]], i32 2
; OFF-NEXT: [[VAL2:%.*]] = insertelement <4 x i32> [[VAL2_UPTO2]], i32 [[VAL2_I3]], i32 3
More information about the llvm-branch-commits
mailing list