Skip to content

Commit 28ac873

Browse files
committed
[SLP]Fix gathering of the scalars by not ignoring UndefValues.
The compiler should not ignore UndefValue when gathering the scalars, otherwise the resulting code may be less defined than the original one. Also, grouped scalars to insert them at first to reduce the analysis in further passes. Differential Revision: https://reviews.llvm.org/D105275
1 parent e90c6f5 commit 28ac873

16 files changed

+66
-60
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4838,9 +4838,6 @@ Value *BoUpSLP::gather(ArrayRef<Value *> VL) {
48384838
}
48394839

48404840
auto &&CreateInsertElement = [this](Value *Vec, Value *V, unsigned Pos) {
4841-
// No need to insert undefs elements - exit.
4842-
if (isa<UndefValue>(V))
4843-
return Vec;
48444841
Vec = Builder.CreateInsertElement(Vec, V, Builder.getInt32(Pos));
48454842
auto *InsElt = dyn_cast<InsertElementInst>(Vec);
48464843
if (!InsElt)
@@ -4865,11 +4862,20 @@ Value *BoUpSLP::gather(ArrayRef<Value *> VL) {
48654862
isa<StoreInst>(VL[0]) ? cast<StoreInst>(VL[0])->getValueOperand() : VL[0];
48664863
FixedVectorType *VecTy = FixedVectorType::get(Val0->getType(), VL.size());
48674864
Value *Vec = PoisonValue::get(VecTy);
4865+
SmallVector<int> NonConsts;
4866+
// Insert constant values at first.
48684867
for (int I = 0, E = VL.size(); I < E; ++I) {
48694868
if (PostponedIndices.contains(I))
48704869
continue;
4870+
if (!isConstant(VL[I])) {
4871+
NonConsts.push_back(I);
4872+
continue;
4873+
}
48714874
Vec = CreateInsertElement(Vec, VL[I], I);
48724875
}
4876+
// Insert non-constant values.
4877+
for (int I : NonConsts)
4878+
Vec = CreateInsertElement(Vec, VL[I], I);
48734879
// Append instructions, which are/may be part of the loop, in the end to make
48744880
// it possible to hoist non-loop-based instructions.
48754881
for (const std::pair<Value *, unsigned> &Pair : PostponedInsts)
@@ -5043,7 +5049,7 @@ Value *BoUpSLP::vectorizeTree(ArrayRef<Value *> VL) {
50435049
UniqueValues.append(VL.begin(), std::next(VL.begin(), NumValues));
50445050
}
50455051
UniqueValues.append(VF - UniqueValues.size(),
5046-
UndefValue::get(VL[0]->getType()));
5052+
PoisonValue::get(VL[0]->getType()));
50475053
VL = UniqueValues;
50485054
}
50495055

llvm/test/Transforms/SLPVectorizer/AArch64/insertelement-inseltpoison.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target triple = "aarch64-unknown-linux-gnu"
66

77
define <2 x float> @insertelement-fixed-vector() {
88
; CHECK-LABEL: @insertelement-fixed-vector(
9-
; CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x float> @llvm.fabs.v2f32(<2 x float> poison)
9+
; CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x float> @llvm.fabs.v2f32(<2 x float> undef)
1010
; CHECK-NEXT: ret <2 x float> [[TMP1]]
1111
;
1212
%f0 = tail call fast float @llvm.fabs.f32(float undef)

llvm/test/Transforms/SLPVectorizer/AArch64/insertelement.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target triple = "aarch64-unknown-linux-gnu"
66

77
define <2 x float> @insertelement-fixed-vector() {
88
; CHECK-LABEL: @insertelement-fixed-vector(
9-
; CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x float> @llvm.fabs.v2f32(<2 x float> poison)
9+
; CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x float> @llvm.fabs.v2f32(<2 x float> undef)
1010
; CHECK-NEXT: ret <2 x float> [[TMP1]]
1111
;
1212
%f0 = tail call fast float @llvm.fabs.f32(float undef)

llvm/test/Transforms/SLPVectorizer/AArch64/trunc-insertion.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ define dso_local void @l() local_unnamed_addr {
88
; CHECK-NEXT: bb:
99
; CHECK-NEXT: br label [[BB1:%.*]]
1010
; CHECK: bb1:
11-
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x i16> [ poison, [[BB:%.*]] ], [ [[TMP11:%.*]], [[BB25:%.*]] ]
11+
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x i16> [ undef, [[BB:%.*]] ], [ [[TMP11:%.*]], [[BB25:%.*]] ]
1212
; CHECK-NEXT: br i1 undef, label [[BB3:%.*]], label [[BB11:%.*]]
1313
; CHECK: bb3:
1414
; CHECK-NEXT: [[I4:%.*]] = zext i1 undef to i32
15-
; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i16> [[TMP0]], poison
15+
; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i16> [[TMP0]], undef
1616
; CHECK-NEXT: [[TMP2:%.*]] = icmp ugt <2 x i16> [[TMP1]], <i16 8, i16 8>
1717
; CHECK-NEXT: [[TMP3:%.*]] = zext <2 x i1> [[TMP2]] to <2 x i32>
1818
; CHECK-NEXT: br label [[BB25]]
1919
; CHECK: bb11:
2020
; CHECK-NEXT: [[I12:%.*]] = zext i1 undef to i32
21-
; CHECK-NEXT: [[TMP4:%.*]] = xor <2 x i16> [[TMP0]], poison
21+
; CHECK-NEXT: [[TMP4:%.*]] = xor <2 x i16> [[TMP0]], undef
2222
; CHECK-NEXT: [[TMP5:%.*]] = sext <2 x i16> [[TMP4]] to <2 x i64>
23-
; CHECK-NEXT: [[TMP6:%.*]] = icmp ule <2 x i64> poison, [[TMP5]]
23+
; CHECK-NEXT: [[TMP6:%.*]] = icmp ule <2 x i64> undef, [[TMP5]]
2424
; CHECK-NEXT: [[TMP7:%.*]] = zext <2 x i1> [[TMP6]] to <2 x i32>
25-
; CHECK-NEXT: [[TMP8:%.*]] = icmp ult <2 x i32> poison, [[TMP7]]
25+
; CHECK-NEXT: [[TMP8:%.*]] = icmp ult <2 x i32> undef, [[TMP7]]
2626
; CHECK-NEXT: [[TMP9:%.*]] = zext <2 x i1> [[TMP8]] to <2 x i32>
2727
; CHECK-NEXT: br label [[BB25]]
2828
; CHECK: bb25:

llvm/test/Transforms/SLPVectorizer/X86/crash_exceed_scheduling.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ define void @exceed(double %0, double %1) {
3434
; CHECK-NEXT: [[TMP11:%.*]] = fadd fast <2 x double> [[TMP3]], [[TMP5]]
3535
; CHECK-NEXT: [[TMP12:%.*]] = fmul fast <2 x double> [[TMP10]], [[TMP11]]
3636
; CHECK-NEXT: [[IXX101:%.*]] = fsub double undef, undef
37-
; CHECK-NEXT: [[TMP13:%.*]] = insertelement <2 x double> poison, double [[TMP7]], i32 0
38-
; CHECK-NEXT: [[TMP14:%.*]] = insertelement <2 x double> poison, double [[TMP1]], i32 1
37+
; CHECK-NEXT: [[TMP13:%.*]] = insertelement <2 x double> <double poison, double undef>, double [[TMP7]], i32 0
38+
; CHECK-NEXT: [[TMP14:%.*]] = insertelement <2 x double> <double undef, double poison>, double [[TMP1]], i32 1
3939
; CHECK-NEXT: [[TMP15:%.*]] = fmul fast <2 x double> [[TMP13]], [[TMP14]]
4040
; CHECK-NEXT: switch i32 undef, label [[BB1:%.*]] [
4141
; CHECK-NEXT: i32 0, label [[BB2:%.*]]

llvm/test/Transforms/SLPVectorizer/X86/crash_lencod.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ define fastcc void @dct36(double* %inbuf) {
130130
; CHECK-NEXT: [[TMP0:%.*]] = bitcast double* [[INBUF]] to <2 x double>*
131131
; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, <2 x double>* [[TMP0]], align 8
132132
; CHECK-NEXT: [[TMP2:%.*]] = extractelement <2 x double> [[TMP1]], i32 1
133-
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x double> poison, double [[TMP2]], i32 0
133+
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x double> <double poison, double undef>, double [[TMP2]], i32 0
134134
; CHECK-NEXT: [[TMP4:%.*]] = fadd <2 x double> [[TMP1]], [[TMP3]]
135135
; CHECK-NEXT: [[TMP5:%.*]] = bitcast double* [[ARRAYIDX44]] to <2 x double>*
136136
; CHECK-NEXT: store <2 x double> [[TMP4]], <2 x double>* [[TMP5]], align 8

llvm/test/Transforms/SLPVectorizer/X86/crash_mandeltext.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ define void @zot(%struct.hoge* %arg) {
9797
; CHECK-NEXT: [[TMP2:%.*]] = load double, double* undef, align 8
9898
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x double> poison, double [[TMP2]], i32 0
9999
; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> [[TMP0]], double [[TMP]], i32 1
100-
; CHECK-NEXT: [[TMP2:%.*]] = fsub <2 x double> [[TMP1]], poison
100+
; CHECK-NEXT: [[TMP2:%.*]] = fsub <2 x double> [[TMP1]], undef
101101
; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT_HOGE:%.*]], %struct.hoge* [[ARG:%.*]], i64 0, i32 1
102-
; CHECK-NEXT: [[TMP3:%.*]] = fmul <2 x double> [[TMP2]], poison
103-
; CHECK-NEXT: [[TMP4:%.*]] = fsub <2 x double> [[TMP3]], poison
102+
; CHECK-NEXT: [[TMP3:%.*]] = fmul <2 x double> [[TMP2]], undef
103+
; CHECK-NEXT: [[TMP4:%.*]] = fsub <2 x double> [[TMP3]], undef
104104
; CHECK-NEXT: [[TMP5:%.*]] = bitcast double* [[TMP7]] to <2 x double>*
105105
; CHECK-NEXT: store <2 x double> [[TMP4]], <2 x double>* [[TMP5]], align 8
106106
; CHECK-NEXT: br i1 undef, label [[BB11:%.*]], label [[BB12:%.*]]

llvm/test/Transforms/SLPVectorizer/X86/crash_smallpt.ll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ define void @main() #0 {
3030
; CHECK-NEXT: br i1 undef, label [[COND_TRUE63_US:%.*]], label [[COND_FALSE66_US:%.*]]
3131
; CHECK: cond.false66.us:
3232
; CHECK-NEXT: [[ADD_I276_US:%.*]] = fadd double 0.000000e+00, undef
33-
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x double> poison, double [[ADD_I276_US]], i32 0
33+
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x double> <double poison, double undef>, double [[ADD_I276_US]], i32 0
3434
; CHECK-NEXT: [[TMP1:%.*]] = fadd <2 x double> [[TMP0]], <double 0.000000e+00, double 0xBFA5CC2D1960285F>
3535
; CHECK-NEXT: [[TMP2:%.*]] = fmul <2 x double> [[TMP1]], <double 1.400000e+02, double 1.400000e+02>
3636
; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP2]], <double 5.000000e+01, double 5.200000e+01>
37-
; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x double> poison, [[TMP1]]
37+
; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x double> undef, [[TMP1]]
3838
; CHECK-NEXT: [[TMP5:%.*]] = bitcast double* [[AGG_TMP99208_SROA_0_0_IDX]] to <2 x double>*
3939
; CHECK-NEXT: store <2 x double> [[TMP3]], <2 x double>* [[TMP5]], align 8
4040
; CHECK-NEXT: [[TMP6:%.*]] = bitcast double* [[AGG_TMP101211_SROA_0_0_IDX]] to <2 x double>*
@@ -110,14 +110,14 @@ define void @_Z8radianceRK3RayiPt() #0 {
110110
; CHECK-NEXT: entry:
111111
; CHECK-NEXT: br i1 undef, label [[IF_THEN78:%.*]], label [[IF_THEN38:%.*]]
112112
; CHECK: if.then38:
113-
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x double> poison, double poison, i32 1
114-
; CHECK-NEXT: [[TMP1:%.*]] = fmul <2 x double> poison, [[TMP0]]
115-
; CHECK-NEXT: [[TMP2:%.*]] = fsub <2 x double> poison, [[TMP1]]
116-
; CHECK-NEXT: [[TMP3:%.*]] = fmul <2 x double> poison, [[TMP2]]
117-
; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x double> poison, [[TMP3]]
118-
; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> poison, [[TMP4]]
119-
; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> poison, [[TMP5]]
120-
; CHECK-NEXT: [[TMP7:%.*]] = fmul <2 x double> poison, [[TMP6]]
113+
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x double> <double undef, double poison>, double undef, i32 1
114+
; CHECK-NEXT: [[TMP1:%.*]] = fmul <2 x double> undef, [[TMP0]]
115+
; CHECK-NEXT: [[TMP2:%.*]] = fsub <2 x double> undef, [[TMP1]]
116+
; CHECK-NEXT: [[TMP3:%.*]] = fmul <2 x double> undef, [[TMP2]]
117+
; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x double> undef, [[TMP3]]
118+
; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> undef, [[TMP4]]
119+
; CHECK-NEXT: [[TMP6:%.*]] = fadd <2 x double> undef, [[TMP5]]
120+
; CHECK-NEXT: [[TMP7:%.*]] = fmul <2 x double> undef, [[TMP6]]
121121
; CHECK-NEXT: [[AGG_TMP74663_SROA_0_0_IDX:%.*]] = getelementptr inbounds [[STRUCT_RAY_5_11_53_95_137_191_197_203_239_257_263_269_275_281_287_293_383_437_443_455_461_599_601:%.*]], %struct.Ray.5.11.53.95.137.191.197.203.239.257.263.269.275.281.287.293.383.437.443.455.461.599.601* undef, i64 0, i32 1, i32 0
122122
; CHECK-NEXT: [[TMP8:%.*]] = bitcast double* [[AGG_TMP74663_SROA_0_0_IDX]] to <2 x double>*
123123
; CHECK-NEXT: store <2 x double> [[TMP7]], <2 x double>* [[TMP8]], align 8

llvm/test/Transforms/SLPVectorizer/X86/geps-non-pow-2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define dso_local i32 @g() local_unnamed_addr {
1212
; CHECK-NEXT: br i1 [[TOBOOL_NOT19]], label [[WHILE_END:%.*]], label [[WHILE_BODY:%.*]]
1313
; CHECK: while.body:
1414
; CHECK-NEXT: [[C_022:%.*]] = phi i32* [ [[C_022_BE:%.*]], [[WHILE_BODY_BACKEDGE:%.*]] ], [ undef, [[ENTRY:%.*]] ]
15-
; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x i32*> [ [[TMP14:%.*]], [[WHILE_BODY_BACKEDGE]] ], [ poison, [[ENTRY]] ]
15+
; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x i32*> [ [[TMP14:%.*]], [[WHILE_BODY_BACKEDGE]] ], [ undef, [[ENTRY]] ]
1616
; CHECK-NEXT: [[INCDEC_PTR:%.*]] = getelementptr inbounds i32, i32* [[C_022]], i64 1
1717
; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint i32* [[C_022]] to i64
1818
; CHECK-NEXT: [[TMP3:%.*]] = trunc i64 [[TMP2]] to i32

llvm/test/Transforms/SLPVectorizer/X86/phi3.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ define void @Rf_GReset() {
1414
; CHECK-LABEL: @Rf_GReset(
1515
; CHECK-NEXT: entry:
1616
; CHECK-NEXT: [[TMP0:%.*]] = load double, double* @d, align 8
17-
; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> poison, double [[TMP0]], i32 1
17+
; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> <double undef, double poison>, double [[TMP0]], i32 1
1818
; CHECK-NEXT: [[TMP2:%.*]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[TMP1]]
1919
; CHECK-NEXT: br i1 icmp eq (%struct.GPar.0.16.26* (...)* inttoptr (i64 115 to %struct.GPar.0.16.26* (...)*), %struct.GPar.0.16.26* (...)* @Rf_gpptr), label [[IF_THEN:%.*]], label [[IF_END7:%.*]]
2020
; CHECK: if.then:
21-
; CHECK-NEXT: [[TMP3:%.*]] = fsub <2 x double> [[TMP2]], poison
22-
; CHECK-NEXT: [[TMP4:%.*]] = fdiv <2 x double> [[TMP3]], poison
21+
; CHECK-NEXT: [[TMP3:%.*]] = fsub <2 x double> [[TMP2]], undef
22+
; CHECK-NEXT: [[TMP4:%.*]] = fdiv <2 x double> [[TMP3]], undef
2323
; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x double> [[TMP4]], i32 0
2424
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x double> [[TMP4]], i32 1
2525
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt double [[TMP5]], [[TMP6]]
@@ -55,12 +55,12 @@ define void @Rf_GReset_unary_fneg() {
5555
; CHECK-LABEL: @Rf_GReset_unary_fneg(
5656
; CHECK-NEXT: entry:
5757
; CHECK-NEXT: [[TMP0:%.*]] = load double, double* @d, align 8
58-
; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> poison, double [[TMP0]], i32 1
58+
; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> <double undef, double poison>, double [[TMP0]], i32 1
5959
; CHECK-NEXT: [[TMP2:%.*]] = fneg <2 x double> [[TMP1]]
6060
; CHECK-NEXT: br i1 icmp eq (%struct.GPar.0.16.26* (...)* inttoptr (i64 115 to %struct.GPar.0.16.26* (...)*), %struct.GPar.0.16.26* (...)* @Rf_gpptr), label [[IF_THEN:%.*]], label [[IF_END7:%.*]]
6161
; CHECK: if.then:
62-
; CHECK-NEXT: [[TMP3:%.*]] = fsub <2 x double> [[TMP2]], poison
63-
; CHECK-NEXT: [[TMP4:%.*]] = fdiv <2 x double> [[TMP3]], poison
62+
; CHECK-NEXT: [[TMP3:%.*]] = fsub <2 x double> [[TMP2]], undef
63+
; CHECK-NEXT: [[TMP4:%.*]] = fdiv <2 x double> [[TMP3]], undef
6464
; CHECK-NEXT: [[TMP5:%.*]] = extractelement <2 x double> [[TMP4]], i32 0
6565
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x double> [[TMP4]], i32 1
6666
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt double [[TMP5]], [[TMP6]]

llvm/test/Transforms/SLPVectorizer/X86/phi_landingpad.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ define void @test_phi_in_landingpad() personality i8*
1212
; CHECK-NEXT: invoke void @foo()
1313
; CHECK-NEXT: to label [[DONE:%.*]] unwind label [[LPAD]]
1414
; CHECK: lpad:
15-
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x double> [ poison, [[ENTRY:%.*]] ], [ poison, [[INNER]] ]
15+
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x double> [ undef, [[ENTRY:%.*]] ], [ undef, [[INNER]] ]
1616
; CHECK-NEXT: [[TMP1:%.*]] = landingpad { i8*, i32 }
1717
; CHECK-NEXT: catch i8* null
1818
; CHECK-NEXT: br label [[DONE]]
1919
; CHECK: done:
20-
; CHECK-NEXT: [[TMP2:%.*]] = phi <2 x double> [ poison, [[INNER]] ], [ [[TMP0]], [[LPAD]] ]
20+
; CHECK-NEXT: [[TMP2:%.*]] = phi <2 x double> [ undef, [[INNER]] ], [ [[TMP0]], [[LPAD]] ]
2121
; CHECK-NEXT: ret void
2222
;
2323
bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {

llvm/test/Transforms/SLPVectorizer/X86/pr35497.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ define void @pr35497() local_unnamed_addr #0 {
103103
; AVX-NEXT: [[ADD:%.*]] = add i64 undef, undef
104104
; AVX-NEXT: store i64 [[ADD]], i64* undef, align 1
105105
; AVX-NEXT: [[ARRAYIDX2_1:%.*]] = getelementptr inbounds [0 x i64], [0 x i64]* undef, i64 0, i64 5
106-
; AVX-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> poison, i64 [[TMP0]], i32 1
106+
; AVX-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> <i64 undef, i64 poison>, i64 [[TMP0]], i32 1
107107
; AVX-NEXT: [[TMP2:%.*]] = shl <2 x i64> [[TMP1]], <i64 2, i64 2>
108108
; AVX-NEXT: [[TMP3:%.*]] = and <2 x i64> [[TMP2]], <i64 20, i64 20>
109109
; AVX-NEXT: [[ARRAYIDX2_2:%.*]] = getelementptr inbounds [0 x i64], [0 x i64]* undef, i64 0, i64 4
110-
; AVX-NEXT: [[TMP4:%.*]] = add nuw nsw <2 x i64> [[TMP3]], poison
110+
; AVX-NEXT: [[TMP4:%.*]] = add nuw nsw <2 x i64> [[TMP3]], zeroinitializer
111111
; AVX-NEXT: [[ARRAYIDX2_5:%.*]] = getelementptr inbounds [0 x i64], [0 x i64]* undef, i64 0, i64 1
112112
; AVX-NEXT: [[TMP5:%.*]] = extractelement <2 x i64> [[TMP4]], i32 1
113113
; AVX-NEXT: [[TMP6:%.*]] = insertelement <2 x i64> poison, i64 [[TMP5]], i32 0

llvm/test/Transforms/SLPVectorizer/X86/reorder_repeated_ops.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ define void @hoge() {
1111
; CHECK-NEXT: ret void
1212
; CHECK: bb2:
1313
; CHECK-NEXT: [[T:%.*]] = select i1 undef, i16 undef, i16 15
14-
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i16> poison, i16 [[T]], i32 0
14+
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i16> <i16 poison, i16 undef>, i16 [[T]], i32 0
1515
; CHECK-NEXT: [[TMP1:%.*]] = sext <2 x i16> [[TMP0]] to <2 x i32>
16-
; CHECK-NEXT: [[TMP2:%.*]] = sub nsw <2 x i32> <i32 poison, i32 63>, [[TMP1]]
17-
; CHECK-NEXT: [[TMP3:%.*]] = sub <2 x i32> [[TMP2]], poison
16+
; CHECK-NEXT: [[TMP2:%.*]] = sub nsw <2 x i32> <i32 undef, i32 63>, [[TMP1]]
17+
; CHECK-NEXT: [[TMP3:%.*]] = sub <2 x i32> [[TMP2]], undef
1818
; CHECK-NEXT: [[SHUFFLE10:%.*]] = shufflevector <2 x i32> [[TMP3]], <2 x i32> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
1919
; CHECK-NEXT: [[TMP4:%.*]] = add <4 x i32> [[SHUFFLE10]], <i32 15, i32 31, i32 47, i32 poison>
2020
; CHECK-NEXT: [[TMP5:%.*]] = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> [[TMP4]])
2121
; CHECK-NEXT: [[T19:%.*]] = select i1 undef, i32 [[TMP5]], i32 undef
2222
; CHECK-NEXT: [[T20:%.*]] = icmp sgt i32 [[T19]], 63
23-
; CHECK-NEXT: [[TMP6:%.*]] = sub nsw <2 x i32> poison, [[TMP1]]
24-
; CHECK-NEXT: [[TMP7:%.*]] = sub <2 x i32> [[TMP6]], poison
23+
; CHECK-NEXT: [[TMP6:%.*]] = sub nsw <2 x i32> undef, [[TMP1]]
24+
; CHECK-NEXT: [[TMP7:%.*]] = sub <2 x i32> [[TMP6]], undef
2525
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i32> [[TMP7]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
2626
; CHECK-NEXT: [[TMP8:%.*]] = add nsw <4 x i32> [[SHUFFLE]], <i32 -49, i32 -33, i32 -33, i32 -17>
2727
; CHECK-NEXT: [[TMP9:%.*]] = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> [[TMP8]])

llvm/test/Transforms/SLPVectorizer/X86/shrink_after_reorder.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ define internal i32 @ipvideo_decode_block_opcode_0xD_16() {
6666
; CHECK-NEXT: entry:
6767
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
6868
; CHECK: for.body:
69-
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x i16> [ poison, [[ENTRY:%.*]] ], [ [[SHRINK_SHUFFLE:%.*]], [[IF_END:%.*]] ]
69+
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x i16> [ undef, [[ENTRY:%.*]] ], [ [[SHRINK_SHUFFLE:%.*]], [[IF_END:%.*]] ]
7070
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i16> [[TMP0]], <2 x i16> poison, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1>
7171
; CHECK-NEXT: br label [[IF_END]]
7272
; CHECK: if.end:

llvm/test/Transforms/SLPVectorizer/X86/value-bug-inseltpoison.ll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ define void @test() {
1313
; CHECK-NEXT: bb279:
1414
; CHECK-NEXT: br label [[BB283:%.*]]
1515
; CHECK: bb283:
16-
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x float> [ poison, [[BB279:%.*]] ], [ [[TMP11:%.*]], [[EXIT:%.*]] ]
17-
; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x float> [ poison, [[BB279]] ], [ poison, [[EXIT]] ]
16+
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x float> [ undef, [[BB279:%.*]] ], [ [[TMP11:%.*]], [[EXIT:%.*]] ]
17+
; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x float> [ undef, [[BB279]] ], [ undef, [[EXIT]] ]
1818
; CHECK-NEXT: br label [[BB284:%.*]]
1919
; CHECK: bb284:
2020
; CHECK-NEXT: [[TMP2:%.*]] = fpext <2 x float> [[TMP0]] to <2 x double>
21-
; CHECK-NEXT: [[TMP3:%.*]] = fsub <2 x double> [[TMP2]], poison
22-
; CHECK-NEXT: [[TMP4:%.*]] = fsub <2 x double> [[TMP3]], poison
21+
; CHECK-NEXT: [[TMP3:%.*]] = fsub <2 x double> [[TMP2]], undef
22+
; CHECK-NEXT: [[TMP4:%.*]] = fsub <2 x double> [[TMP3]], undef
2323
; CHECK-NEXT: br label [[BB21_I:%.*]]
2424
; CHECK: bb21.i:
2525
; CHECK-NEXT: br i1 undef, label [[BB22_I:%.*]], label [[EXIT]]
2626
; CHECK: bb22.i:
27-
; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> poison, [[TMP4]]
27+
; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x double> undef, [[TMP4]]
2828
; CHECK-NEXT: br label [[BB32_I:%.*]]
2929
; CHECK: bb32.i:
3030
; CHECK-NEXT: [[TMP6:%.*]] = phi <2 x double> [ [[TMP5]], [[BB22_I]] ], [ zeroinitializer, [[BB32_I]] ]
3131
; CHECK-NEXT: br i1 undef, label [[BB32_I]], label [[BB21_I]]
3232
; CHECK: exit:
3333
; CHECK-NEXT: [[TMP7:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double>
34-
; CHECK-NEXT: [[TMP8:%.*]] = fmul <2 x double> [[TMP7]], <double poison, double 0.000000e+00>
35-
; CHECK-NEXT: [[TMP9:%.*]] = fadd <2 x double> poison, [[TMP8]]
36-
; CHECK-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[TMP9]], poison
34+
; CHECK-NEXT: [[TMP8:%.*]] = fmul <2 x double> [[TMP7]], <double undef, double 0.000000e+00>
35+
; CHECK-NEXT: [[TMP9:%.*]] = fadd <2 x double> undef, [[TMP8]]
36+
; CHECK-NEXT: [[TMP10:%.*]] = fadd <2 x double> [[TMP9]], undef
3737
; CHECK-NEXT: [[TMP11]] = fptrunc <2 x double> [[TMP10]] to <2 x float>
3838
; CHECK-NEXT: br label [[BB283]]
3939
;

0 commit comments

Comments
 (0)