Skip to content

Commit 86813aa

Browse files
committed
[VPlan] Add dedicated user for resume phi with epilogue vectorization.
Epilogue vectorization currently relies on the resume phi for the canonical induction being always available, which is why VPPhi are considered to have side-effects, to prevent their removal. This patch adds a new ResumeForEpilogue opcode to mark the resume phi as used for epilogue vectorization. This allows treating VPPhis in general as not having side-effects, enabling removal of unused VPPhis.
1 parent a2d353e commit 86813aa

File tree

99 files changed

+151
-603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+151
-603
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,11 +2386,13 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
23862386
/// successors of VPBB, if any, are rewired to the new VPIRBasicBlock.
23872387
static void replaceVPBBWithIRVPBB(VPBasicBlock *VPBB, BasicBlock *IRBB) {
23882388
VPIRBasicBlock *IRVPBB = VPBB->getPlan()->createVPIRBasicBlock(IRBB);
2389-
for (auto &R : make_early_inc_range(*VPBB)) {
2390-
assert((IRVPBB->empty() || IRVPBB->back().isPhi() || !R.isPhi()) &&
2391-
"Tried to move phi recipe after a non-phi recipe");
2389+
auto IP = IRVPBB->begin();
2390+
for (auto &R : make_early_inc_range(VPBB->phis()))
2391+
R.moveBefore(*IRVPBB, IP);
2392+
2393+
for (auto &R :
2394+
make_early_inc_range(make_range(VPBB->getFirstNonPhi(), VPBB->end())))
23922395
R.moveBefore(*IRVPBB, IRVPBB->end());
2393-
}
23942396

23952397
VPBlockUtils::reassociateBlocks(VPBB, IRVPBB);
23962398
// VPBB is now dead and will be cleaned up when the plan gets destroyed.
@@ -9742,6 +9744,9 @@ static void preparePlanForMainVectorLoop(VPlan &MainPlan, VPlan &EpiPlan) {
97429744
else if (&*MainScalarPH->begin() != ResumePhi)
97439745
ResumePhi->moveBefore(*MainScalarPH, MainScalarPH->begin());
97449746
}
9747+
// Add a user to to make sure the resume phi won't get removed.
9748+
VPBuilder(MainScalarPH)
9749+
.createNaryOp(VPInstruction::ResumeForEpilogue, ResumePhi);
97459750
}
97469751

97479752
/// Prepare \p Plan for vectorizing the epilogue loop. That is, re-use expanded

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,9 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
10191019
/// The lane specifies an index into a vector formed by combining all vector
10201020
/// operands (all operands after the first one).
10211021
ExtractLane,
1022+
/// Explicit user for the resume phi of the canonical induction in the main
1023+
/// VPlan, used by the epilogue vector loop.
1024+
ResumeForEpilogue
10221025

10231026
};
10241027

llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPInstruction *R) {
7474
case Instruction::ExtractElement:
7575
case Instruction::Freeze:
7676
case VPInstruction::ReductionStartVector:
77+
case VPInstruction::ResumeForEpilogue:
7778
return inferScalarType(R->getOperand(0));
7879
case Instruction::Select: {
7980
Type *ResTy = inferScalarType(R->getOperand(1));

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,8 @@ Value *VPInstruction::generate(VPTransformState &State) {
922922

923923
return Res;
924924
}
925+
case VPInstruction::ResumeForEpilogue:
926+
return State.get(getOperand(0), true);
925927
default:
926928
llvm_unreachable("Unsupported opcode for instruction");
927929
}
@@ -1027,6 +1029,7 @@ bool VPInstruction::isSingleScalar() const {
10271029
switch (getOpcode()) {
10281030
case Instruction::PHI:
10291031
case VPInstruction::ExplicitVectorLength:
1032+
case VPInstruction::ResumeForEpilogue:
10301033
return true;
10311034
default:
10321035
return isScalarCast();
@@ -1076,6 +1079,7 @@ bool VPInstruction::opcodeMayReadOrWriteFromMemory() const {
10761079
case Instruction::FCmp:
10771080
case Instruction::ICmp:
10781081
case Instruction::Select:
1082+
case Instruction::PHI:
10791083
case VPInstruction::AnyOf:
10801084
case VPInstruction::BuildStructVector:
10811085
case VPInstruction::BuildVector:
@@ -1251,6 +1255,9 @@ void VPInstruction::print(raw_ostream &O, const Twine &Indent,
12511255
case VPInstruction::ReductionStartVector:
12521256
O << "reduction-start-vector";
12531257
break;
1258+
case VPInstruction::ResumeForEpilogue:
1259+
O << "resume-for-epilogue";
1260+
break;
12541261
default:
12551262
O << Instruction::getOpcodeName(getOpcode());
12561263
}

llvm/test/Transforms/LoopVectorize/AArch64/clamped-trip-count.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ define void @clamped_tc_8(ptr nocapture %dst, i32 %n, i64 %val) vscale_range(1,1
3535
; CHECK: middle.block:
3636
; CHECK-NEXT: br label [[FOR_COND_CLEANUP:%.*]]
3737
; CHECK: scalar.ph:
38-
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ]
39-
; CHECK-NEXT: [[BC_RESUME_VAL1:%.*]] = phi ptr [ [[DST]], [[ENTRY]] ]
4038
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
4139
; CHECK: for.body:
4240
; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
@@ -112,8 +110,6 @@ define void @clamped_tc_max_8(ptr nocapture %dst, i32 %n, i64 %val) vscale_range
112110
; CHECK: middle.block:
113111
; CHECK-NEXT: br label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]]
114112
; CHECK: scalar.ph:
115-
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, [[FOR_BODY_PREHEADER]] ]
116-
; CHECK-NEXT: [[BC_RESUME_VAL1:%.*]] = phi ptr [ [[DST]], [[FOR_BODY_PREHEADER]] ]
117113
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
118114
; CHECK: for.body:
119115
; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]

llvm/test/Transforms/LoopVectorize/AArch64/conditional-branches-cost.ll

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ define void @latch_branch_cost(ptr %dst) {
377377
;
378378
; PRED-LABEL: define void @latch_branch_cost(
379379
; PRED-SAME: ptr [[DST:%.*]]) {
380-
; PRED-NEXT: [[ENTRY:.*]]:
380+
; PRED-NEXT: [[ENTRY:.*:]]
381381
; PRED-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
382382
; PRED: [[VECTOR_PH]]:
383383
; PRED-NEXT: br label %[[VECTOR_BODY:.*]]
@@ -456,7 +456,6 @@ define void @latch_branch_cost(ptr %dst) {
456456
; PRED: [[MIDDLE_BLOCK]]:
457457
; PRED-NEXT: br label %[[EXIT:.*]]
458458
; PRED: [[SCALAR_PH]]:
459-
; PRED-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
460459
; PRED-NEXT: br label %[[LOOP:.*]]
461460
; PRED: [[LOOP]]:
462461
; PRED-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
@@ -697,7 +696,7 @@ define void @multiple_exit_conditions(ptr %src, ptr noalias %dst) #1 {
697696
;
698697
; PRED-LABEL: define void @multiple_exit_conditions(
699698
; PRED-SAME: ptr [[SRC:%.*]], ptr noalias [[DST:%.*]]) #[[ATTR2:[0-9]+]] {
700-
; PRED-NEXT: [[ENTRY:.*]]:
699+
; PRED-NEXT: [[ENTRY:.*:]]
701700
; PRED-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
702701
; PRED: [[VECTOR_PH]]:
703702
; PRED-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
@@ -728,8 +727,6 @@ define void @multiple_exit_conditions(ptr %src, ptr noalias %dst) #1 {
728727
; PRED: [[MIDDLE_BLOCK]]:
729728
; PRED-NEXT: br label %[[EXIT:.*]]
730729
; PRED: [[SCALAR_PH]]:
731-
; PRED-NEXT: [[BC_RESUME_VAL:%.*]] = phi ptr [ [[DST]], %[[ENTRY]] ]
732-
; PRED-NEXT: [[BC_RESUME_VAL1:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
733730
; PRED-NEXT: br label %[[LOOP:.*]]
734731
; PRED: [[LOOP]]:
735732
; PRED-NEXT: [[PTR_IV:%.*]] = phi ptr [ [[DST]], %[[SCALAR_PH]] ], [ [[PTR_IV_NEXT:%.*]], %[[LOOP]] ]
@@ -769,7 +766,7 @@ exit:
769766
define void @low_trip_count_fold_tail_scalarized_store(ptr %dst) {
770767
; DEFAULT-LABEL: define void @low_trip_count_fold_tail_scalarized_store(
771768
; DEFAULT-SAME: ptr [[DST:%.*]]) {
772-
; DEFAULT-NEXT: [[ENTRY:.*]]:
769+
; DEFAULT-NEXT: [[ENTRY:.*:]]
773770
; DEFAULT-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
774771
; DEFAULT: [[VECTOR_PH]]:
775772
; DEFAULT-NEXT: br label %[[VECTOR_BODY:.*]]
@@ -856,7 +853,6 @@ define void @low_trip_count_fold_tail_scalarized_store(ptr %dst) {
856853
; DEFAULT: [[MIDDLE_BLOCK]]:
857854
; DEFAULT-NEXT: br label %[[EXIT:.*]]
858855
; DEFAULT: [[SCALAR_PH]]:
859-
; DEFAULT-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
860856
; DEFAULT-NEXT: br label %[[LOOP:.*]]
861857
; DEFAULT: [[LOOP]]:
862858
; DEFAULT-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
@@ -871,7 +867,7 @@ define void @low_trip_count_fold_tail_scalarized_store(ptr %dst) {
871867
;
872868
; PRED-LABEL: define void @low_trip_count_fold_tail_scalarized_store(
873869
; PRED-SAME: ptr [[DST:%.*]]) {
874-
; PRED-NEXT: [[ENTRY:.*]]:
870+
; PRED-NEXT: [[ENTRY:.*:]]
875871
; PRED-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
876872
; PRED: [[VECTOR_PH]]:
877873
; PRED-NEXT: br label %[[VECTOR_BODY:.*]]
@@ -958,7 +954,6 @@ define void @low_trip_count_fold_tail_scalarized_store(ptr %dst) {
958954
; PRED: [[MIDDLE_BLOCK]]:
959955
; PRED-NEXT: br label %[[EXIT:.*]]
960956
; PRED: [[SCALAR_PH]]:
961-
; PRED-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
962957
; PRED-NEXT: br label %[[LOOP:.*]]
963958
; PRED: [[LOOP]]:
964959
; PRED-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
@@ -1497,7 +1492,7 @@ define void @redundant_branch_and_tail_folding(ptr %dst, i1 %c) {
14971492
;
14981493
; PRED-LABEL: define void @redundant_branch_and_tail_folding(
14991494
; PRED-SAME: ptr [[DST:%.*]], i1 [[C:%.*]]) {
1500-
; PRED-NEXT: [[ENTRY:.*]]:
1495+
; PRED-NEXT: [[ENTRY:.*:]]
15011496
; PRED-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
15021497
; PRED: [[VECTOR_PH]]:
15031498
; PRED-NEXT: br label %[[VECTOR_BODY:.*]]
@@ -1542,7 +1537,6 @@ define void @redundant_branch_and_tail_folding(ptr %dst, i1 %c) {
15421537
; PRED: [[MIDDLE_BLOCK]]:
15431538
; PRED-NEXT: br label %[[EXIT:.*]]
15441539
; PRED: [[SCALAR_PH]]:
1545-
; PRED-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
15461540
; PRED-NEXT: br label %[[LOOP_HEADER:.*]]
15471541
; PRED: [[LOOP_HEADER]]:
15481542
; PRED-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP_LATCH:.*]] ]

llvm/test/Transforms/LoopVectorize/AArch64/first-order-recurrence-fold-tail.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ define i32 @test_phi_iterator_invalidation(ptr %A, ptr noalias %B) {
7171
; CHECK: middle.block:
7272
; CHECK-NEXT: br label [[EXIT:%.*]]
7373
; CHECK: scalar.ph:
74-
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ]
75-
; CHECK-NEXT: [[SCALAR_RECUR_INIT:%.*]] = phi i16 [ 0, [[ENTRY]] ]
7674
; CHECK-NEXT: br label [[LOOP:%.*]]
7775
; CHECK: loop:
7876
; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ]

llvm/test/Transforms/LoopVectorize/AArch64/optsize_minsize.ll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ for.cond.cleanup:
221221
define void @tail_predicate_without_optsize(ptr %p, i8 %a, i8 %b, i8 %c, i32 %n) {
222222
; DEFAULT-LABEL: define void @tail_predicate_without_optsize(
223223
; DEFAULT-SAME: ptr [[P:%.*]], i8 [[A:%.*]], i8 [[B:%.*]], i8 [[C:%.*]], i32 [[N:%.*]]) {
224-
; DEFAULT-NEXT: [[ENTRY:.*]]:
224+
; DEFAULT-NEXT: [[ENTRY:.*:]]
225225
; DEFAULT-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
226226
; DEFAULT: [[VECTOR_PH]]:
227227
; DEFAULT-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <16 x i8> poison, i8 [[A]], i64 0
@@ -394,7 +394,6 @@ define void @tail_predicate_without_optsize(ptr %p, i8 %a, i8 %b, i8 %c, i32 %n)
394394
; DEFAULT: [[MIDDLE_BLOCK]]:
395395
; DEFAULT-NEXT: br label %[[FOR_COND_CLEANUP:.*]]
396396
; DEFAULT: [[SCALAR_PH]]:
397-
; DEFAULT-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
398397
; DEFAULT-NEXT: br label %[[FOR_BODY:.*]]
399398
; DEFAULT: [[FOR_BODY]]:
400399
; DEFAULT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]
@@ -490,7 +489,7 @@ for.cond.cleanup:
490489
define void @sve_tail_predicate_without_minsize(ptr %p, i8 %a, i8 %b, i8 %c, i32 %n) #0 {
491490
; DEFAULT-LABEL: define void @sve_tail_predicate_without_minsize(
492491
; DEFAULT-SAME: ptr [[P:%.*]], i8 [[A:%.*]], i8 [[B:%.*]], i8 [[C:%.*]], i32 [[N:%.*]]) #[[ATTR0:[0-9]+]] {
493-
; DEFAULT-NEXT: [[ENTRY:.*]]:
492+
; DEFAULT-NEXT: [[ENTRY:.*:]]
494493
; DEFAULT-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
495494
; DEFAULT: [[VECTOR_PH]]:
496495
; DEFAULT-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
@@ -537,7 +536,6 @@ define void @sve_tail_predicate_without_minsize(ptr %p, i8 %a, i8 %b, i8 %c, i32
537536
; DEFAULT: [[MIDDLE_BLOCK]]:
538537
; DEFAULT-NEXT: br label %[[FOR_COND_CLEANUP:.*]]
539538
; DEFAULT: [[SCALAR_PH]]:
540-
; DEFAULT-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
541539
; DEFAULT-NEXT: br label %[[FOR_BODY:.*]]
542540
; DEFAULT: [[FOR_BODY]]:
543541
; DEFAULT-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[FOR_BODY]] ]
@@ -559,7 +557,7 @@ define void @sve_tail_predicate_without_minsize(ptr %p, i8 %a, i8 %b, i8 %c, i32
559557
;
560558
; OPTSIZE-LABEL: define void @sve_tail_predicate_without_minsize(
561559
; OPTSIZE-SAME: ptr [[P:%.*]], i8 [[A:%.*]], i8 [[B:%.*]], i8 [[C:%.*]], i32 [[N:%.*]]) #[[ATTR1:[0-9]+]] {
562-
; OPTSIZE-NEXT: [[ENTRY:.*]]:
560+
; OPTSIZE-NEXT: [[ENTRY:.*:]]
563561
; OPTSIZE-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
564562
; OPTSIZE: [[VECTOR_PH]]:
565563
; OPTSIZE-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
@@ -606,7 +604,6 @@ define void @sve_tail_predicate_without_minsize(ptr %p, i8 %a, i8 %b, i8 %c, i32
606604
; OPTSIZE: [[MIDDLE_BLOCK]]:
607605
; OPTSIZE-NEXT: br label %[[FOR_COND_CLEANUP:.*]]
608606
; OPTSIZE: [[SCALAR_PH]]:
609-
; OPTSIZE-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
610607
; OPTSIZE-NEXT: br label %[[FOR_BODY:.*]]
611608
; OPTSIZE: [[FOR_BODY]]:
612609
; OPTSIZE-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[FOR_BODY]] ]
@@ -628,7 +625,7 @@ define void @sve_tail_predicate_without_minsize(ptr %p, i8 %a, i8 %b, i8 %c, i32
628625
;
629626
; MINSIZE-LABEL: define void @sve_tail_predicate_without_minsize(
630627
; MINSIZE-SAME: ptr [[P:%.*]], i8 [[A:%.*]], i8 [[B:%.*]], i8 [[C:%.*]], i32 [[N:%.*]]) #[[ATTR1:[0-9]+]] {
631-
; MINSIZE-NEXT: [[ENTRY:.*]]:
628+
; MINSIZE-NEXT: [[ENTRY:.*:]]
632629
; MINSIZE-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
633630
; MINSIZE: [[VECTOR_PH]]:
634631
; MINSIZE-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
@@ -675,7 +672,6 @@ define void @sve_tail_predicate_without_minsize(ptr %p, i8 %a, i8 %b, i8 %c, i32
675672
; MINSIZE: [[MIDDLE_BLOCK]]:
676673
; MINSIZE-NEXT: br label %[[FOR_COND_CLEANUP:.*]]
677674
; MINSIZE: [[SCALAR_PH]]:
678-
; MINSIZE-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
679675
; MINSIZE-NEXT: br label %[[FOR_BODY:.*]]
680676
; MINSIZE: [[FOR_BODY]]:
681677
; MINSIZE-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[FOR_BODY]] ]

llvm/test/Transforms/LoopVectorize/AArch64/pr73894.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ define i32 @pr70988(ptr %src, i32 %n) {
5252
; CHECK-NEXT: [[RDX_MINMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[TMP17]], i32 [[TMP18]])
5353
; CHECK-NEXT: br label [[EXIT:%.*]]
5454
; CHECK: scalar.ph:
55-
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ]
56-
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, [[ENTRY]] ]
5755
; CHECK-NEXT: br label [[LOOP:%.*]]
5856
; CHECK: loop:
5957
; CHECK-NEXT: [[INDUC:%.*]] = phi i64 [ 0, [[SCALAR_PH]] ], [ [[INDUC_NEXT:%.*]], [[LOOP]] ]

llvm/test/Transforms/LoopVectorize/AArch64/reduction-recurrence-costs-sve.ll

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ define i32 @chained_recurrences(i32 %x, i64 %y, ptr %src.1, i32 %z, ptr %src.2)
174174
;
175175
; PRED-LABEL: define i32 @chained_recurrences(
176176
; PRED-SAME: i32 [[X:%.*]], i64 [[Y:%.*]], ptr [[SRC_1:%.*]], i32 [[Z:%.*]], ptr [[SRC_2:%.*]]) #[[ATTR0:[0-9]+]] {
177-
; PRED-NEXT: [[ENTRY:.*]]:
177+
; PRED-NEXT: [[ENTRY:.*:]]
178178
; PRED-NEXT: [[TMP0:%.*]] = add i64 [[Y]], 1
179179
; PRED-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
180180
; PRED: [[VECTOR_PH]]:
@@ -242,10 +242,6 @@ define i32 @chained_recurrences(i32 %x, i64 %y, ptr %src.1, i32 %z, ptr %src.2)
242242
; PRED-NEXT: [[TMP44:%.*]] = call i32 @llvm.vector.reduce.or.nxv4i32(<vscale x 4 x i32> [[TMP41]])
243243
; PRED-NEXT: br label %[[EXIT:.*]]
244244
; PRED: [[SCALAR_PH]]:
245-
; PRED-NEXT: [[SCALAR_RECUR_INIT:%.*]] = phi i32 [ 0, %[[ENTRY]] ]
246-
; PRED-NEXT: [[SCALAR_RECUR_INIT8:%.*]] = phi i32 [ 0, %[[ENTRY]] ]
247-
; PRED-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
248-
; PRED-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ 0, %[[ENTRY]] ]
249245
; PRED-NEXT: br label %[[LOOP:.*]]
250246
; PRED: [[LOOP]]:
251247
; PRED-NEXT: [[TMP45:%.*]] = phi i32 [ 0, %[[SCALAR_PH]] ], [ [[TMP53:%.*]], %[[LOOP]] ]
@@ -436,7 +432,7 @@ define i16 @reduce_udiv(ptr %src, i16 %x, i64 %N) #0 {
436432
;
437433
; PRED-LABEL: define i16 @reduce_udiv(
438434
; PRED-SAME: ptr [[SRC:%.*]], i16 [[X:%.*]], i64 [[N:%.*]]) #[[ATTR0]] {
439-
; PRED-NEXT: [[ENTRY:.*]]:
435+
; PRED-NEXT: [[ENTRY:.*:]]
440436
; PRED-NEXT: [[TMP0:%.*]] = add i64 [[N]], 1
441437
; PRED-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
442438
; PRED: [[VECTOR_PH]]:
@@ -469,8 +465,6 @@ define i16 @reduce_udiv(ptr %src, i16 %x, i64 %N) #0 {
469465
; PRED-NEXT: [[TMP19:%.*]] = call i16 @llvm.vector.reduce.or.nxv8i16(<vscale x 8 x i16> [[TMP16]])
470466
; PRED-NEXT: br label %[[EXIT:.*]]
471467
; PRED: [[SCALAR_PH]]:
472-
; PRED-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ 0, %[[ENTRY]] ]
473-
; PRED-NEXT: [[BC_MERGE_RDX:%.*]] = phi i16 [ 0, %[[ENTRY]] ]
474468
; PRED-NEXT: br label %[[LOOP:.*]]
475469
; PRED: [[LOOP]]:
476470
; PRED-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[SCALAR_PH]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]

0 commit comments

Comments
 (0)