Skip to content

Commit d79d9b8

Browse files
[SLP]Change the insertion point for outside-block-used nodes and prevec phi operand gathers
Need to set the insertion point for (non-schedulable) vector node after the last instruction in the node to avoid def-use breakage. But it also causes miscompilation with gather/buildvector operands of the phi nodes, used in the same phi only in the block. These nodes supposed to be inserted at the end of the block and after changing the insertion point for the non-schedulable vec block, it also may break def-use dependencies. Need to prevector such nodes, to emit them as early as possible, so the vectorized nodes are inserted before these nodes. Fixes #139728 Reviewers: hiraditya, HanKuanChen, RKSimon Reviewed By: RKSimon Pull Request: #139917
1 parent 7674d6f commit d79d9b8

10 files changed

+99
-33
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16142,16 +16142,10 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
1614216142
[](Value *V) {
1614316143
return !isa<GetElementPtrInst>(V) && isa<Instruction>(V);
1614416144
})) ||
16145-
all_of(E->Scalars,
16146-
[](Value *V) {
16147-
return isa<PoisonValue>(V) ||
16148-
(!isVectorLikeInstWithConstOps(V) &&
16149-
isUsedOutsideBlock(V));
16150-
}) ||
16151-
(E->isGather() && E->Idx == 0 && all_of(E->Scalars, [](Value *V) {
16152-
return isa<ExtractElementInst, UndefValue>(V) ||
16153-
areAllOperandsNonInsts(V);
16154-
})))
16145+
all_of(E->Scalars, [](Value *V) {
16146+
return isa<PoisonValue>(V) ||
16147+
(!isVectorLikeInstWithConstOps(V) && isUsedOutsideBlock(V));
16148+
}))
1615516149
Res = FindLastInst();
1615616150
else
1615716151
Res = FindFirstInst();
@@ -16210,7 +16204,7 @@ void BoUpSLP::setInsertPointAfterBundle(const TreeEntry *E) {
1621016204
}
1621116205
if (IsPHI ||
1621216206
(!E->isGather() && E->State != TreeEntry::SplitVectorize &&
16213-
doesNotNeedToSchedule(E->Scalars)) ||
16207+
all_of(E->Scalars, areAllOperandsNonInsts)) ||
1621416208
(GatheredLoadsEntriesFirst.has_value() &&
1621516209
E->Idx >= *GatheredLoadsEntriesFirst && !E->isGather() &&
1621616210
E->getOpcode() == Instruction::Load)) {
@@ -17799,17 +17793,27 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
1779917793
Value *VecOp = NewPhi->getIncomingValueForBlock(IBB);
1780017794
NewPhi->addIncoming(VecOp, IBB);
1780117795
TreeEntry *OpTE = getOperandEntry(E, I);
17796+
assert(!OpTE->VectorizedValue && "Expected no vectorized value.");
1780217797
OpTE->VectorizedValue = VecOp;
1780317798
continue;
1780417799
}
1780517800

1780617801
Builder.SetInsertPoint(IBB->getTerminator());
1780717802
Builder.SetCurrentDebugLocation(PH->getDebugLoc());
17808-
Value *Vec = vectorizeOperand(E, I);
17803+
const TreeEntry *OpE = getOperandEntry(E, I);
17804+
Value *Vec;
17805+
if (OpE->isGather()) {
17806+
assert(OpE->VectorizedValue && "Expected vectorized value.");
17807+
Vec = OpE->VectorizedValue;
17808+
if (auto *IVec = dyn_cast<Instruction>(Vec))
17809+
Builder.SetInsertPoint(IVec->getNextNonDebugInstruction());
17810+
} else {
17811+
Vec = vectorizeOperand(E, I);
17812+
}
1780917813
if (VecTy != Vec->getType()) {
17810-
assert((It != MinBWs.end() || getOperandEntry(E, I)->isGather() ||
17811-
MinBWs.contains(getOperandEntry(E, I))) &&
17812-
"Expected item in MinBWs.");
17814+
assert(
17815+
(It != MinBWs.end() || OpE->isGather() || MinBWs.contains(OpE)) &&
17816+
"Expected item in MinBWs.");
1781317817
Vec = Builder.CreateIntCast(Vec, VecTy, GetOperandSignedness(I));
1781417818
}
1781517819
NewPhi->addIncoming(Vec, IBB);
@@ -18696,6 +18700,28 @@ Value *BoUpSLP::vectorizeTree(
1869618700
else
1869718701
Builder.SetInsertPoint(&F->getEntryBlock(), F->getEntryBlock().begin());
1869818702

18703+
// Vectorize gather operands of the PHI nodes.
18704+
for (const std::unique_ptr<TreeEntry> &TE : reverse(VectorizableTree)) {
18705+
if (TE->isGather() && TE->UserTreeIndex.UserTE &&
18706+
TE->UserTreeIndex.UserTE->hasState() &&
18707+
!TE->UserTreeIndex.UserTE->isAltShuffle() &&
18708+
TE->UserTreeIndex.UserTE->State == TreeEntry::Vectorize &&
18709+
TE->UserTreeIndex.UserTE->getOpcode() == Instruction::PHI &&
18710+
!TE->VectorizedValue) {
18711+
auto *PH = cast<PHINode>(TE->UserTreeIndex.UserTE->getMainOp());
18712+
BasicBlock *IBB = PH->getIncomingBlock(TE->UserTreeIndex.EdgeIdx);
18713+
// If there is the same incoming block earlier - skip, it will be handled
18714+
// in PHI node.
18715+
if (TE->UserTreeIndex.EdgeIdx > 0 &&
18716+
any_of(seq<unsigned>(TE->UserTreeIndex.EdgeIdx), [&](unsigned Idx) {
18717+
return PH->getIncomingBlock(Idx) == IBB;
18718+
}))
18719+
continue;
18720+
Builder.SetInsertPoint(IBB->getTerminator());
18721+
Builder.SetCurrentDebugLocation(PH->getDebugLoc());
18722+
(void)vectorizeTree(TE.get());
18723+
}
18724+
}
1869918725
// Emit gathered loads first to emit better code for the users of those
1870018726
// gathered loads.
1870118727
for (const std::unique_ptr<TreeEntry> &TE : VectorizableTree) {

llvm/test/Transforms/SLPVectorizer/AArch64/reused-scalar-repeated-in-node.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ define void @test() {
3737
; CHECK-NEXT: [[TMP11:%.*]] = insertelement <16 x float> [[TMP10]], float [[I69]], i32 15
3838
; CHECK-NEXT: br i1 poison, label %[[BB167:.*]], label %[[BB77:.*]]
3939
; CHECK: [[BB77]]:
40-
; CHECK-NEXT: [[TMP12:%.*]] = shufflevector <16 x float> [[TMP11]], <16 x float> poison, <8 x i32> <i32 poison, i32 poison, i32 poison, i32 poison, i32 14, i32 15, i32 poison, i32 poison>
41-
; CHECK-NEXT: [[TMP17:%.*]] = insertelement <8 x float> poison, float [[I70]], i32 0
42-
; CHECK-NEXT: [[TMP23:%.*]] = shufflevector <8 x float> [[TMP12]], <8 x float> [[TMP17]], <8 x i32> <i32 8, i32 poison, i32 poison, i32 poison, i32 4, i32 5, i32 poison, i32 poison>
4340
; CHECK-NEXT: [[TMP14:%.*]] = insertelement <8 x float> poison, float [[I70]], i32 1
4441
; CHECK-NEXT: [[TMP19:%.*]] = insertelement <8 x float> [[TMP14]], float [[I68]], i32 2
4542
; CHECK-NEXT: [[TMP16:%.*]] = insertelement <8 x float> [[TMP19]], float [[I66]], i32 3
4643
; CHECK-NEXT: [[TMP20:%.*]] = insertelement <8 x float> [[TMP16]], float [[I67]], i32 6
4744
; CHECK-NEXT: [[TMP21:%.*]] = insertelement <8 x float> [[TMP20]], float [[I69]], i32 7
45+
; CHECK-NEXT: [[TMP17:%.*]] = shufflevector <16 x float> [[TMP11]], <16 x float> poison, <8 x i32> <i32 poison, i32 poison, i32 poison, i32 poison, i32 14, i32 15, i32 poison, i32 poison>
46+
; CHECK-NEXT: [[TMP23:%.*]] = insertelement <8 x float> poison, float [[I70]], i32 0
47+
; CHECK-NEXT: [[TMP30:%.*]] = shufflevector <8 x float> [[TMP17]], <8 x float> [[TMP23]], <8 x i32> <i32 8, i32 poison, i32 poison, i32 poison, i32 4, i32 5, i32 poison, i32 poison>
4848
; CHECK-NEXT: [[TMP39:%.*]] = shufflevector <16 x float> [[TMP25]], <16 x float> poison, <16 x i32> <i32 poison, i32 poison, i32 3, i32 2, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
4949
; CHECK-NEXT: [[TMP13:%.*]] = shufflevector <16 x float> [[TMP39]], <16 x float> [[TMP25]], <16 x i32> <i32 poison, i32 poison, i32 2, i32 3, i32 18, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 19, i32 poison, i32 poison>
5050
; CHECK-NEXT: br label %[[BB78:.*]]
5151
; CHECK: [[BB78]]:
52-
; CHECK-NEXT: [[TMP15:%.*]] = phi <8 x float> [ [[TMP23]], %[[BB77]] ], [ [[TMP36:%.*]], %[[BB78]] ]
52+
; CHECK-NEXT: [[TMP15:%.*]] = phi <8 x float> [ [[TMP30]], %[[BB77]] ], [ [[TMP36:%.*]], %[[BB78]] ]
5353
; CHECK-NEXT: [[TMP22:%.*]] = phi <8 x float> [ [[TMP21]], %[[BB77]] ], [ [[TMP31:%.*]], %[[BB78]] ]
5454
; CHECK-NEXT: [[TMP24:%.*]] = shufflevector <8 x float> [[TMP22]], <8 x float> poison, <16 x i32> <i32 0, i32 3, i32 1, i32 2, i32 3, i32 0, i32 2, i32 3, i32 2, i32 6, i32 2, i32 3, i32 0, i32 7, i32 6, i32 6>
5555
; CHECK-NEXT: [[TMP38:%.*]] = shufflevector <8 x float> [[TMP15]], <8 x float> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 1, i32 0, i32 3, i32 1, i32 3, i32 5, i32 3, i32 1, i32 0, i32 4, i32 5, i32 5>
@@ -58,8 +58,8 @@ define void @test() {
5858
; CHECK-NEXT: [[TMP27:%.*]] = fadd fast <16 x float> [[TMP26]], [[TMP18]]
5959
; CHECK-NEXT: [[TMP28:%.*]] = fadd fast <16 x float> [[TMP27]], poison
6060
; CHECK-NEXT: [[TMP29:%.*]] = fadd fast <16 x float> [[TMP28]], poison
61-
; CHECK-NEXT: [[TMP36]] = shufflevector <16 x float> [[TMP29]], <16 x float> poison, <8 x i32> <i32 5, i32 11, i32 12, i32 10, i32 14, i32 15, i32 poison, i32 poison>
6261
; CHECK-NEXT: [[TMP31]] = shufflevector <16 x float> [[TMP29]], <16 x float> poison, <8 x i32> <i32 12, i32 5, i32 6, i32 7, i32 poison, i32 poison, i32 14, i32 15>
62+
; CHECK-NEXT: [[TMP36]] = shufflevector <16 x float> [[TMP29]], <16 x float> poison, <8 x i32> <i32 5, i32 11, i32 12, i32 10, i32 14, i32 15, i32 poison, i32 poison>
6363
; CHECK-NEXT: br i1 poison, label %[[BB78]], label %[[BB167]]
6464
; CHECK: [[BB167]]:
6565
; CHECK-NEXT: [[TMP32:%.*]] = phi <16 x float> [ [[TMP11]], %[[BB64]] ], [ [[TMP29]], %[[BB78]] ]

llvm/test/Transforms/SLPVectorizer/X86/buildvectors-parent-phi-nodes.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ define void @test(ptr %0, float %1) {
55
; CHECK-LABEL: define void @test(
66
; CHECK-SAME: ptr [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0:[0-9]+]] {
77
; CHECK-NEXT: [[TMP3:%.*]] = load float, ptr [[TMP0]], align 4
8-
; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x float> <float 0.000000e+00, float poison>, float [[TMP3]], i32 1
98
; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x float> <float poison, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float [[TMP3]], i32 0
9+
; CHECK-NEXT: [[TMP8:%.*]] = insertelement <2 x float> <float 0.000000e+00, float poison>, float [[TMP3]], i32 1
1010
; CHECK-NEXT: [[TMP6:%.*]] = insertelement <2 x float> poison, float [[TMP1]], i32 0
1111
; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x float> [[TMP6]], <2 x float> poison, <2 x i32> zeroinitializer
1212
; CHECK-NEXT: br label %[[BB8:.*]]
1313
; CHECK: [[BB8]]:
1414
; CHECK-NEXT: [[TMP9:%.*]] = phi <4 x float> [ [[TMP15:%.*]], %[[BB8]] ], [ [[TMP5]], [[TMP2:%.*]] ]
15-
; CHECK-NEXT: [[TMP10:%.*]] = phi <2 x float> [ [[TMP7]], %[[BB8]] ], [ [[TMP4]], [[TMP2]] ]
15+
; CHECK-NEXT: [[TMP10:%.*]] = phi <2 x float> [ [[TMP7]], %[[BB8]] ], [ [[TMP8]], [[TMP2]] ]
1616
; CHECK-NEXT: [[TMP11:%.*]] = shufflevector <2 x float> [[TMP10]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 0>
1717
; CHECK-NEXT: [[TMP12:%.*]] = fmul <4 x float> [[TMP9]], zeroinitializer
1818
; CHECK-NEXT: [[TMP13:%.*]] = fadd <4 x float> [[TMP12]], zeroinitializer

llvm/test/Transforms/SLPVectorizer/X86/full-matched-bv-with-subvectors.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ define i32 @test(i64 %l.549) {
66
; CHECK-SAME: i64 [[L_549:%.*]]) {
77
; CHECK-NEXT: [[ENTRY:.*]]:
88
; CHECK-NEXT: [[CONV3:%.*]] = sext i32 0 to i64
9-
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i64> poison, i64 [[CONV3]], i32 3
109
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x i64> poison, i64 0, i32 0
1110
; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i64> [[TMP3]], i64 0, i32 1
11+
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i64> poison, i64 [[CONV3]], i32 3
1212
; CHECK-NEXT: [[TMP8:%.*]] = insertelement <4 x i64> poison, i64 [[L_549]], i32 0
1313
; CHECK-NEXT: [[TMP9:%.*]] = shufflevector <4 x i64> [[TMP8]], <4 x i64> poison, <4 x i32> <i32 poison, i32 0, i32 poison, i32 poison>
1414
; CHECK-NEXT: br label %[[IF_THEN19:.*]]

llvm/test/Transforms/SLPVectorizer/X86/matched-bv-schedulable.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ define void @test() {
77
; CHECK-NEXT: br i1 false, label %[[BB1:.*]], label %[[BB5:.*]]
88
; CHECK: [[BB1]]:
99
; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x i32> [ [[TMP3:%.*]], %[[BB1]] ], [ zeroinitializer, %[[BB]] ]
10+
; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x i32> <i32 poison, i32 0>, i32 0, i32 0
11+
; CHECK-NEXT: [[TMP5:%.*]] = or <2 x i32> [[TMP0]], [[TMP4]]
1012
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i32> [[TMP0]], <2 x i32> <i32 poison, i32 0>, <2 x i32> <i32 0, i32 3>
1113
; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> <i32 poison, i32 1>, i32 0, i32 0
1214
; CHECK-NEXT: [[TMP3]] = or <2 x i32> [[TMP1]], [[TMP2]]
13-
; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x i32> <i32 poison, i32 0>, i32 0, i32 0
14-
; CHECK-NEXT: [[TMP5:%.*]] = or <2 x i32> [[TMP0]], [[TMP4]]
1515
; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i32> [[TMP5]], i32 1
1616
; CHECK-NEXT: [[OR3:%.*]] = or i32 [[TMP6]], 0
1717
; CHECK-NEXT: br i1 false, label %[[BB1]], label %[[BB5]]

llvm/test/Transforms/SLPVectorizer/X86/matched-nodes-updated.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ define i32 @test(i32 %s.0) {
3737
; CHECK: [[IF_THEN18:.*]]:
3838
; CHECK-NEXT: br label %[[T]]
3939
; CHECK: [[T]]:
40-
; CHECK-NEXT: [[TMP30:%.*]] = phi <8 x i32> [ [[TMP27:%.*]], %[[O]] ], [ poison, %[[IF_THEN18]] ]
40+
; CHECK-NEXT: [[TMP19:%.*]] = phi <8 x i32> [ [[TMP27:%.*]], %[[O]] ], [ poison, %[[IF_THEN18]] ]
4141
; CHECK-NEXT: [[TMP17]] = extractelement <4 x i32> [[TMP23:%.*]], i32 0
4242
; CHECK-NEXT: br i1 false, label %[[IF_END24]], label %[[K]]
4343
; CHECK: [[IF_END24]]:
44-
; CHECK-NEXT: [[TMP18:%.*]] = phi <8 x i32> [ [[TMP29]], %[[IF_THEN11]] ], [ [[TMP11]], %[[IF_END6]] ], [ [[TMP30]], %[[T]] ]
45-
; CHECK-NEXT: [[TMP19:%.*]] = shufflevector <8 x i32> [[TMP18]], <8 x i32> poison, <2 x i32> <i32 7, i32 1>
44+
; CHECK-NEXT: [[TMP18:%.*]] = phi <8 x i32> [ [[TMP29]], %[[IF_THEN11]] ], [ [[TMP11]], %[[IF_END6]] ], [ [[TMP19]], %[[T]] ]
4645
; CHECK-NEXT: [[TMP20:%.*]] = shufflevector <8 x i32> [[TMP18]], <8 x i32> poison, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
46+
; CHECK-NEXT: [[TMP30:%.*]] = shufflevector <8 x i32> [[TMP18]], <8 x i32> poison, <2 x i32> <i32 7, i32 1>
4747
; CHECK-NEXT: [[TMP21:%.*]] = shufflevector <8 x i32> [[TMP18]], <8 x i32> poison, <4 x i32> <i32 2, i32 3, i32 4, i32 6>
4848
; CHECK-NEXT: br label %[[O]]
4949
; CHECK: [[O]]:
50-
; CHECK-NEXT: [[TMP22]] = phi <2 x i32> [ zeroinitializer, %[[K]] ], [ [[TMP19]], %[[IF_END24]] ]
5150
; CHECK-NEXT: [[TMP23]] = phi <4 x i32> [ [[TMP1]], %[[K]] ], [ [[TMP20]], %[[IF_END24]] ]
51+
; CHECK-NEXT: [[TMP22]] = phi <2 x i32> [ zeroinitializer, %[[K]] ], [ [[TMP30]], %[[IF_END24]] ]
5252
; CHECK-NEXT: [[TMP24:%.*]] = phi <4 x i32> [ zeroinitializer, %[[K]] ], [ [[TMP21]], %[[IF_END24]] ]
5353
; CHECK-NEXT: [[TMP25:%.*]] = shufflevector <4 x i32> [[TMP23]], <4 x i32> poison, <8 x i32> <i32 0, i32 poison, i32 0, i32 0, i32 poison, i32 poison, i32 poison, i32 poison>
5454
; CHECK-NEXT: [[TMP26:%.*]] = shufflevector <8 x i32> [[TMP25]], <8 x i32> <i32 poison, i32 0, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>, <8 x i32> <i32 0, i32 9, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -slp-threshold=-99999 < %s | FileCheck %s
3+
4+
define i64 @test() {
5+
; CHECK-LABEL: define i64 @test() {
6+
; CHECK-NEXT: [[BB:.*]]:
7+
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> <i32 0, i32 poison>, i32 0, i32 1
8+
; CHECK-NEXT: br label %[[BB1:.*]]
9+
; CHECK: [[BB1]]:
10+
; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x i32> [ zeroinitializer, %[[BB]] ], [ [[TMP4:%.*]], %[[BB5:.*]] ]
11+
; CHECK-NEXT: [[TMP2:%.*]] = or <2 x i32> [[TMP0]], [[TMP1]]
12+
; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> [[TMP2]], <2 x i32> <i32 0, i32 3>
13+
; CHECK-NEXT: [[TMP4]] = or <2 x i32> [[TMP3]], zeroinitializer
14+
; CHECK-NEXT: br label %[[BB5]]
15+
; CHECK: [[BB5]]:
16+
; CHECK-NEXT: br i1 false, label %[[BB6:.*]], label %[[BB1]]
17+
; CHECK: [[BB6]]:
18+
; CHECK-NEXT: [[TMP5:%.*]] = phi <2 x i32> [ [[TMP2]], %[[BB5]] ]
19+
; CHECK-NEXT: ret i64 0
20+
;
21+
bb:
22+
br label %bb1
23+
24+
bb1:
25+
%phi = phi i32 [ 0, %bb ], [ %or, %bb5 ]
26+
%phi2 = phi i32 [ 0, %bb ], [ %or4, %bb5 ]
27+
%or = or i32 %phi, 0
28+
%add = add i32 0, 0
29+
%or3 = or i32 %add, %phi2
30+
%or4 = or i32 %or3, 0
31+
br label %bb5
32+
33+
bb5:
34+
br i1 false, label %bb6, label %bb1
35+
36+
bb6:
37+
%phi7 = phi i32 [ %or, %bb5 ]
38+
%phi8 = phi i32 [ %or3, %bb5 ]
39+
ret i64 0
40+
}

llvm/test/Transforms/SLPVectorizer/X86/reduced-val-vectorized-in-transform.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ define i32 @test(i1 %cond) {
1616
; CHECK-NEXT: [[TMP5:%.*]] = or <4 x i32> zeroinitializer, [[TMP4]]
1717
; CHECK-NEXT: [[OR92]] = or i32 1, 0
1818
; CHECK-NEXT: [[TMP6:%.*]] = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> [[TMP5]])
19+
; CHECK-NEXT: [[OP_RDX:%.*]] = xor i32 [[TMP6]], [[OR92]]
1920
; CHECK-NEXT: [[TMP9:%.*]] = insertelement <2 x i32> <i32 poison, i32 1>, i32 [[TMP6]], i32 0
2021
; CHECK-NEXT: [[TMP7:%.*]] = insertelement <2 x i32> <i32 poison, i32 0>, i32 [[OR92]], i32 0
2122
; CHECK-NEXT: [[TMP8]] = xor <2 x i32> [[TMP9]], [[TMP7]]
22-
; CHECK-NEXT: [[OP_RDX:%.*]] = xor i32 [[TMP6]], [[OR92]]
2323
; CHECK-NEXT: br i1 [[COND]], label %[[EXIT:.*]], label %[[BB]]
2424
; CHECK: [[EXIT]]:
2525
; CHECK-NEXT: ret i32 [[OP_RDX]]

llvm/test/Transforms/SLPVectorizer/X86/split-node-num-operands.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ define i64 @Foo(ptr align 8 dereferenceable(344) %0, i64 %1) {
1515
; CHECK-NEXT: [[TMP11:%.*]] = insertelement <2 x i64> [[TMP10]], i64 [[TMP9]], i32 1
1616
; CHECK-NEXT: [[TMP12:%.*]] = insertelement <2 x i64> poison, i64 [[TMP7]], i32 0
1717
; CHECK-NEXT: [[TMP13:%.*]] = insertelement <2 x i64> [[TMP12]], i64 [[TMP8]], i32 1
18-
; CHECK-NEXT: [[TMP14:%.*]] = insertelement <2 x i64> poison, i64 0, i32 0
1918
; CHECK-NEXT: [[TMP15:%.*]] = insertelement <2 x i64> <i64 0, i64 poison>, i64 [[TMP1]], i32 1
19+
; CHECK-NEXT: [[TMP14:%.*]] = insertelement <2 x i64> poison, i64 0, i32 0
2020
; CHECK-NEXT: br label %[[BB16:.*]]
2121
; CHECK: [[BB16]]:
2222
; CHECK-NEXT: [[TMP17:%.*]] = phi <2 x i64> [ [[TMP11]], [[TMP2:%.*]] ], [ zeroinitializer, %[[TMP25:.*]] ]

llvm/test/Transforms/SLPVectorizer/revec.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ define void @test7() {
234234
define void @test8() {
235235
; CHECK-LABEL: @test8(
236236
; CHECK-NEXT: entry:
237+
; CHECK-NEXT: [[TMP4:%.*]] = call <4 x float> @llvm.vector.insert.v4f32.v2f32(<4 x float> poison, <2 x float> zeroinitializer, i64 0)
238+
; CHECK-NEXT: [[TMP5:%.*]] = call <4 x float> @llvm.vector.insert.v4f32.v2f32(<4 x float> [[TMP4]], <2 x float> zeroinitializer, i64 2)
237239
; CHECK-NEXT: [[TMP0:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v2f32(<8 x float> poison, <2 x float> zeroinitializer, i64 0)
238240
; CHECK-NEXT: [[TMP1:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v2f32(<8 x float> [[TMP0]], <2 x float> zeroinitializer, i64 2)
239241
; CHECK-NEXT: [[TMP2:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v2f32(<8 x float> [[TMP1]], <2 x float> zeroinitializer, i64 4)
240242
; CHECK-NEXT: [[TMP3:%.*]] = call <8 x float> @llvm.vector.insert.v8f32.v2f32(<8 x float> [[TMP2]], <2 x float> zeroinitializer, i64 6)
241-
; CHECK-NEXT: [[TMP4:%.*]] = call <4 x float> @llvm.vector.insert.v4f32.v2f32(<4 x float> poison, <2 x float> zeroinitializer, i64 0)
242-
; CHECK-NEXT: [[TMP5:%.*]] = call <4 x float> @llvm.vector.insert.v4f32.v2f32(<4 x float> [[TMP4]], <2 x float> zeroinitializer, i64 2)
243243
; CHECK-NEXT: br i1 false, label [[FOR0:%.*]], label [[FOR_BODY:%.*]]
244244
; CHECK: for0:
245245
; CHECK-NEXT: [[TMP6:%.*]] = phi <8 x float> [ [[TMP3]], [[ENTRY:%.*]] ], [ [[TMP8:%.*]], [[FOR_BODY]] ]

0 commit comments

Comments
 (0)