Skip to content

Commit f2336d4

Browse files
authored
Revert "[VPlan] Expand WidenInt inductions with nuw/nsw" (llvm#168080)
Reverts llvm#163538 This is causing build failures on the two-stage RVV buildbots. e.g. https://lab.llvm.org/buildbot/#/builders/214/builds/1363. I've shared a reproducer and more information at llvm#163538 (comment) This reverts commit 355e0f9.
1 parent e6f868c commit f2336d4

File tree

119 files changed

+793
-864
lines changed

Some content is hidden

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

119 files changed

+793
-864
lines changed

flang/test/Integration/unroll-loops.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ subroutine unroll(a)
2525
! NO-UNROLL-NEXT: %[[GEP:.*]] = getelementptr i64, ptr %[[ARG0]], i64 %[[IND]]
2626
! NO-UNROLL-NEXT: store <2 x i64> %[[VIND]], ptr %[[GEP]]
2727
! NO-UNROLL-NEXT: %[[NIV:.*]] = add nuw i64 %{{.*}}, 2
28-
! NO-UNROLL-NEXT: %[[NVIND]] = add nuw nsw <2 x i64> %[[VIND]], splat (i64 2)
28+
! NO-UNROLL-NEXT: %[[NVIND]] = add <2 x i64> %[[VIND]], splat (i64 2)
2929
!
3030
! UNROLL-NEXT: %[[VIND1:.*]] = add <2 x i64> %[[VIND]], splat (i64 2)
3131
! UNROLL-NEXT: %[[GEP0:.*]] = getelementptr i64, ptr %[[ARG0]], i64 %[[IND]]

flang/test/Lower/HLFIR/unroll-loops.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func.func @unroll(%arg0: !fir.ref<!fir.array<1000 x index>> {fir.bindc_name = "a
2727
// NO-UNROLL-NEXT: %[[GEP:.*]] = getelementptr i64, ptr %[[ARG0]], i64 %[[IND]]
2828
// NO-UNROLL-NEXT: store <2 x i64> %[[VIND]], ptr %[[GEP]]
2929
// NO-UNROLL-NEXT: %[[NIV:.*]] = add nuw i64 %{{.*}}, 2
30-
// NO-UNROLL-NEXT: %[[NVIND]] = add nuw nsw <2 x i64> %[[VIND]], splat (i64 2)
30+
// NO-UNROLL-NEXT: %[[NVIND]] = add <2 x i64> %[[VIND]], splat (i64 2)
3131

3232
// UNROLL-NEXT: %[[VIND1:.*]] = add <2 x i64> %[[VIND]], splat (i64 2)
3333
// UNROLL-NEXT: %[[GEP0:.*]] = getelementptr i64, ptr %[[ARG0]], i64 %[[IND]]

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7639,10 +7639,6 @@ createWidenInductionRecipes(VPInstruction *PhiR,
76397639
assert(Plan.getLiveIn(IndDesc.getStartValue()) == Start &&
76407640
"Start VPValue must match IndDesc's start value");
76417641

7642-
// It is always safe to copy over the NoWrap and FastMath flags. In
7643-
// particular, when folding tail by masking, the masked-off lanes are never
7644-
// used, so it is safe.
7645-
VPIRFlags Flags = vputils::getFlagsFromIndDesc(IndDesc);
76467642
VPValue *Step =
76477643
vputils::getOrCreateVPValueForSCEVExpr(Plan, IndDesc.getStep());
76487644

@@ -7655,7 +7651,7 @@ createWidenInductionRecipes(VPInstruction *PhiR,
76557651

76567652
PHINode *Phi = cast<PHINode>(PhiR->getUnderlyingInstr());
76577653
return new VPWidenIntOrFpInductionRecipe(Phi, Start, Step, &Plan.getVF(),
7658-
IndDesc, Flags, PhiR->getDebugLoc());
7654+
IndDesc, PhiR->getDebugLoc());
76597655
}
76607656

76617657
VPHeaderPHIRecipe *
@@ -7709,15 +7705,10 @@ VPRecipeBuilder::tryToOptimizeInductionTruncate(VPInstruction *VPI,
77097705
PHINode *Phi = WidenIV->getPHINode();
77107706
VPValue *Start = WidenIV->getStartValue();
77117707
const InductionDescriptor &IndDesc = WidenIV->getInductionDescriptor();
7712-
7713-
// It is always safe to copy over the NoWrap and FastMath flags. In
7714-
// particular, when folding tail by masking, the masked-off lanes are never
7715-
// used, so it is safe.
7716-
VPIRFlags Flags = vputils::getFlagsFromIndDesc(IndDesc);
77177708
VPValue *Step =
77187709
vputils::getOrCreateVPValueForSCEVExpr(Plan, IndDesc.getStep());
7719-
return new VPWidenIntOrFpInductionRecipe(
7720-
Phi, Start, Step, &Plan.getVF(), IndDesc, I, Flags, VPI->getDebugLoc());
7710+
return new VPWidenIntOrFpInductionRecipe(Phi, Start, Step, &Plan.getVF(),
7711+
IndDesc, I, VPI->getDebugLoc());
77217712
}
77227713

77237714
VPSingleDefRecipe *VPRecipeBuilder::tryToWidenCall(VPInstruction *VPI,

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,8 +2124,7 @@ class VPWidenInductionRecipe : public VPHeaderPHIRecipe {
21242124
/// A recipe for handling phi nodes of integer and floating-point inductions,
21252125
/// producing their vector values. This is an abstract recipe and must be
21262126
/// converted to concrete recipes before executing.
2127-
class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe,
2128-
public VPIRFlags {
2127+
class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
21292128
TruncInst *Trunc;
21302129

21312130
// If this recipe is unrolled it will have 2 additional operands.
@@ -2134,20 +2133,19 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe,
21342133
public:
21352134
VPWidenIntOrFpInductionRecipe(PHINode *IV, VPValue *Start, VPValue *Step,
21362135
VPValue *VF, const InductionDescriptor &IndDesc,
2137-
const VPIRFlags &Flags, DebugLoc DL)
2136+
DebugLoc DL)
21382137
: VPWidenInductionRecipe(VPDef::VPWidenIntOrFpInductionSC, IV, Start,
21392138
Step, IndDesc, DL),
2140-
VPIRFlags(Flags), Trunc(nullptr) {
2139+
Trunc(nullptr) {
21412140
addOperand(VF);
21422141
}
21432142

21442143
VPWidenIntOrFpInductionRecipe(PHINode *IV, VPValue *Start, VPValue *Step,
21452144
VPValue *VF, const InductionDescriptor &IndDesc,
2146-
TruncInst *Trunc, const VPIRFlags &Flags,
2147-
DebugLoc DL)
2145+
TruncInst *Trunc, DebugLoc DL)
21482146
: VPWidenInductionRecipe(VPDef::VPWidenIntOrFpInductionSC, IV, Start,
21492147
Step, IndDesc, DL),
2150-
VPIRFlags(Flags), Trunc(Trunc) {
2148+
Trunc(Trunc) {
21512149
addOperand(VF);
21522150
SmallVector<std::pair<unsigned, MDNode *>> Metadata;
21532151
(void)Metadata;
@@ -2161,7 +2159,7 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe,
21612159
VPWidenIntOrFpInductionRecipe *clone() override {
21622160
return new VPWidenIntOrFpInductionRecipe(
21632161
getPHINode(), getStartValue(), getStepValue(), getVFValue(),
2164-
getInductionDescriptor(), Trunc, *this, getDebugLoc());
2162+
getInductionDescriptor(), Trunc, getDebugLoc());
21652163
}
21662164

21672165
VP_CLASSOF_IMPL(VPDef::VPWidenIntOrFpInductionSC)

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,9 +2376,7 @@ void VPWidenIntOrFpInductionRecipe::print(raw_ostream &O, const Twine &Indent,
23762376
VPSlotTracker &SlotTracker) const {
23772377
O << Indent;
23782378
printAsOperand(O, SlotTracker);
2379-
O << " = WIDEN-INDUCTION";
2380-
printFlags(O);
2381-
O << " ";
2379+
O << " = WIDEN-INDUCTION ";
23822380
printOperands(O, SlotTracker);
23832381

23842382
if (auto *TI = getTruncInst())

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,8 @@ bool VPlanTransforms::tryToConvertVPInstructionsToVPRecipes(
7676
VPValue *Start = Plan.getOrAddLiveIn(II->getStartValue());
7777
VPValue *Step =
7878
vputils::getOrCreateVPValueForSCEVExpr(Plan, II->getStep());
79-
// It is always safe to copy over the NoWrap and FastMath flags. In
80-
// particular, when folding tail by masking, the masked-off lanes are
81-
// never used, so it is safe.
82-
VPIRFlags Flags = vputils::getFlagsFromIndDesc(*II);
8379
NewRecipe = new VPWidenIntOrFpInductionRecipe(
84-
Phi, Start, Step, &Plan.getVF(), *II, Flags,
85-
Ingredient.getDebugLoc());
80+
Phi, Start, Step, &Plan.getVF(), *II, Ingredient.getDebugLoc());
8681
}
8782
} else {
8883
assert(isa<VPInstruction>(&Ingredient) &&
@@ -547,11 +542,6 @@ static void removeRedundantCanonicalIVs(VPlan &Plan) {
547542
// only.
548543
if (!vputils::onlyScalarValuesUsed(WidenOriginalIV) ||
549544
vputils::onlyFirstLaneUsed(WidenNewIV)) {
550-
// We are replacing a wide canonical iv with a suitable wide induction.
551-
// This is used to compute header mask, hence all lanes will be used and
552-
// we need to drop wrap flags only applying to lanes guranteed to execute
553-
// in the original scalar loop.
554-
WidenOriginalIV->dropPoisonGeneratingFlags();
555545
WidenNewIV->replaceAllUsesWith(WidenOriginalIV);
556546
WidenNewIV->eraseFromParent();
557547
return;
@@ -3300,13 +3290,16 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
33003290
const InductionDescriptor &ID = WidenIVR->getInductionDescriptor();
33013291
Instruction::BinaryOps AddOp;
33023292
Instruction::BinaryOps MulOp;
3303-
VPIRFlags Flags = *WidenIVR;
3293+
// FIXME: The newly created binary instructions should contain nsw/nuw
3294+
// flags, which can be found from the original scalar operations.
3295+
VPIRFlags Flags;
33043296
if (ID.getKind() == InductionDescriptor::IK_IntInduction) {
33053297
AddOp = Instruction::Add;
33063298
MulOp = Instruction::Mul;
33073299
} else {
33083300
AddOp = ID.getInductionOpcode();
33093301
MulOp = Instruction::FMul;
3302+
Flags = ID.getInductionBinOp()->getFastMathFlags();
33103303
}
33113304

33123305
// If the phi is truncated, truncate the start and step values.

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,6 @@ std::optional<VPValue *>
7373
getRecipesForUncountableExit(VPlan &Plan,
7474
SmallVectorImpl<VPRecipeBase *> &Recipes,
7575
SmallVectorImpl<VPRecipeBase *> &GEPs);
76-
77-
/// Extracts and returns NoWrap and FastMath flags from the induction binop in
78-
/// \p ID.
79-
inline VPIRFlags getFlagsFromIndDesc(const InductionDescriptor &ID) {
80-
if (ID.getKind() == InductionDescriptor::IK_FpInduction)
81-
return ID.getInductionBinOp()->getFastMathFlags();
82-
83-
if (auto *OBO = dyn_cast_if_present<OverflowingBinaryOperator>(
84-
ID.getInductionBinOp()))
85-
return VPIRFlags::WrapFlagsTy(OBO->hasNoUnsignedWrap(),
86-
OBO->hasNoSignedWrap());
87-
return {};
88-
}
8976
} // namespace vputils
9077

9178
//===----------------------------------------------------------------------===//

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ define void @clamped_tc_8(ptr nocapture %dst, i32 %n, i64 %val) vscale_range(1,1
1414
; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i64> poison, i64 [[VAL]], i64 0
1515
; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 8 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1616
; CHECK-NEXT: [[TMP8:%.*]] = call <vscale x 8 x i64> @llvm.stepvector.nxv8i64()
17-
; CHECK-NEXT: [[TMP3:%.*]] = mul <vscale x 8 x i64> [[TMP8]], splat (i64 1)
18-
; CHECK-NEXT: [[INDUCTION:%.*]] = add <vscale x 8 x i64> zeroinitializer, [[TMP3]]
17+
; CHECK-NEXT: [[TMP7:%.*]] = mul <vscale x 8 x i64> [[TMP8]], splat (i64 1)
18+
; CHECK-NEXT: [[INDUCTION:%.*]] = add <vscale x 8 x i64> zeroinitializer, [[TMP7]]
1919
; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i64> poison, i64 [[TMP1]], i64 0
2020
; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i64> [[DOTSPLATINSERT]], <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
2121
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
@@ -76,8 +76,8 @@ define void @clamped_tc_max_8(ptr nocapture %dst, i32 %n, i64 %val) vscale_range
7676
; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 8 x i64> poison, i64 [[VAL]], i64 0
7777
; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 8 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
7878
; CHECK-NEXT: [[TMP8:%.*]] = call <vscale x 8 x i64> @llvm.stepvector.nxv8i64()
79-
; CHECK-NEXT: [[TMP3:%.*]] = mul <vscale x 8 x i64> [[TMP8]], splat (i64 1)
80-
; CHECK-NEXT: [[INDUCTION:%.*]] = add <vscale x 8 x i64> zeroinitializer, [[TMP3]]
79+
; CHECK-NEXT: [[TMP7:%.*]] = mul <vscale x 8 x i64> [[TMP8]], splat (i64 1)
80+
; CHECK-NEXT: [[INDUCTION:%.*]] = add <vscale x 8 x i64> zeroinitializer, [[TMP7]]
8181
; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 8 x i64> poison, i64 [[TMP1]], i64 0
8282
; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 8 x i64> [[DOTSPLATINSERT]], <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
8383
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ define void @redundant_branch_and_tail_folding(ptr %dst, i1 %c) {
10521052
; DEFAULT-NEXT: [[TMP2:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3
10531053
; DEFAULT-NEXT: store i32 [[TMP2]], ptr [[DST]], align 4
10541054
; DEFAULT-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8
1055-
; DEFAULT-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <4 x i64> [[STEP_ADD]], splat (i64 4)
1055+
; DEFAULT-NEXT: [[VEC_IND_NEXT]] = add <4 x i64> [[STEP_ADD]], splat (i64 4)
10561056
; DEFAULT-NEXT: [[TMP3:%.*]] = icmp eq i64 [[INDEX_NEXT]], 16
10571057
; DEFAULT-NEXT: br i1 [[TMP3]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP27:![0-9]+]]
10581058
; DEFAULT: [[MIDDLE_BLOCK]]:

llvm/test/Transforms/LoopVectorize/AArch64/epilog-iv-select-cmp.ll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ define i8 @select_icmp_var_start(ptr %a, i8 %n, i8 %start) {
3535
; CHECK-NEXT: [[TMP10]] = select <16 x i1> [[TMP17]], <16 x i8> [[VEC_IND]], <16 x i8> [[VEC_PHI]]
3636
; CHECK-NEXT: [[TMP11]] = select <16 x i1> [[TMP23]], <16 x i8> [[STEP_ADD]], <16 x i8> [[VEC_PHI2]]
3737
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 32
38-
; CHECK-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <16 x i8> [[STEP_ADD]], splat (i8 16)
38+
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <16 x i8> [[STEP_ADD]], splat (i8 16)
3939
; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
4040
; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
4141
; CHECK: [[MIDDLE_BLOCK]]:
@@ -48,7 +48,7 @@ define i8 @select_icmp_var_start(ptr %a, i8 %n, i8 %start) {
4848
; CHECK: [[VEC_EPILOG_ITER_CHECK]]:
4949
; CHECK-NEXT: [[IND_END:%.*]] = trunc i32 [[N_VEC]] to i8
5050
; CHECK-NEXT: [[MIN_EPILOG_ITERS_CHECK:%.*]] = icmp ult i32 [[N_MOD_VF]], 8
51-
; CHECK-NEXT: br i1 [[MIN_EPILOG_ITERS_CHECK]], label %[[VEC_EPILOG_SCALAR_PH]], label %[[VEC_EPILOG_PH]], !prof [[PROF3:![0-9]+]]
51+
; CHECK-NEXT: br i1 [[MIN_EPILOG_ITERS_CHECK]], label %[[VEC_EPILOG_SCALAR_PH]], label %[[VEC_EPILOG_PH]]
5252
; CHECK: [[VEC_EPILOG_PH]]:
5353
; CHECK-NEXT: [[VEC_EPILOG_RESUME_VAL:%.*]] = phi i32 [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
5454
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i8 [ [[TMP3]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
@@ -62,21 +62,21 @@ define i8 @select_icmp_var_start(ptr %a, i8 %n, i8 %start) {
6262
; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x i8> [[DOTSPLATINSERT]], <8 x i8> poison, <8 x i32> zeroinitializer
6363
; CHECK-NEXT: [[DOTSPLATINSERT10:%.*]] = insertelement <8 x i8> poison, i8 [[BC_RESUME_VAL]], i64 0
6464
; CHECK-NEXT: [[DOTSPLAT11:%.*]] = shufflevector <8 x i8> [[DOTSPLATINSERT10]], <8 x i8> poison, <8 x i32> zeroinitializer
65-
; CHECK-NEXT: [[INDUCTION:%.*]] = add nuw nsw <8 x i8> [[DOTSPLAT11]], <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>
65+
; CHECK-NEXT: [[INDUCTION:%.*]] = add <8 x i8> [[DOTSPLAT11]], <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>
6666
; CHECK-NEXT: br label %[[VEC_EPILOG_VECTOR_BODY:.*]]
6767
; CHECK: [[VEC_EPILOG_VECTOR_BODY]]:
6868
; CHECK-NEXT: [[INDEX6:%.*]] = phi i32 [ [[VEC_EPILOG_RESUME_VAL]], %[[VEC_EPILOG_PH]] ], [ [[INDEX_NEXT13:%.*]], %[[VEC_EPILOG_VECTOR_BODY]] ]
69-
; CHECK-NEXT: [[VEC_IND7:%.*]] = phi <8 x i8> [ [[INDUCTION]], %[[VEC_EPILOG_PH]] ], [ [[VEC_IND_NEXT13:%.*]], %[[VEC_EPILOG_VECTOR_BODY]] ]
69+
; CHECK-NEXT: [[VEC_IND7:%.*]] = phi <8 x i8> [ [[INDUCTION]], %[[VEC_EPILOG_PH]] ], [ [[VEC_IND_NEXT8:%.*]], %[[VEC_EPILOG_VECTOR_BODY]] ]
7070
; CHECK-NEXT: [[VEC_PHI9:%.*]] = phi <8 x i8> [ [[DOTSPLAT]], %[[VEC_EPILOG_PH]] ], [ [[TMP20:%.*]], %[[VEC_EPILOG_VECTOR_BODY]] ]
7171
; CHECK-NEXT: [[IV:%.*]] = trunc i32 [[INDEX6]] to i8
7272
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr [[A]], i8 [[IV]]
7373
; CHECK-NEXT: [[WIDE_LOAD12:%.*]] = load <8 x i8>, ptr [[GEP]], align 8
7474
; CHECK-NEXT: [[TMP19:%.*]] = icmp eq <8 x i8> [[WIDE_LOAD12]], splat (i8 3)
7575
; CHECK-NEXT: [[TMP20]] = select <8 x i1> [[TMP19]], <8 x i8> [[VEC_IND7]], <8 x i8> [[VEC_PHI9]]
7676
; CHECK-NEXT: [[INDEX_NEXT13]] = add nuw i32 [[INDEX6]], 8
77-
; CHECK-NEXT: [[VEC_IND_NEXT13]] = add nuw nsw <8 x i8> [[VEC_IND7]], splat (i8 8)
77+
; CHECK-NEXT: [[VEC_IND_NEXT8]] = add <8 x i8> [[VEC_IND7]], splat (i8 8)
7878
; CHECK-NEXT: [[TMP21:%.*]] = icmp eq i32 [[INDEX_NEXT13]], [[N_VEC5]]
79-
; CHECK-NEXT: br i1 [[TMP21]], label %[[VEC_EPILOG_MIDDLE_BLOCK:.*]], label %[[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]
79+
; CHECK-NEXT: br i1 [[TMP21]], label %[[VEC_EPILOG_MIDDLE_BLOCK:.*]], label %[[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP3:![0-9]+]]
8080
; CHECK: [[VEC_EPILOG_MIDDLE_BLOCK]]:
8181
; CHECK-NEXT: [[TMP22:%.*]] = call i8 @llvm.vector.reduce.smax.v8i8(<8 x i8> [[TMP20]])
8282
; CHECK-NEXT: [[RDX_SELECT_CMP14:%.*]] = icmp ne i8 [[TMP22]], -128
@@ -96,7 +96,7 @@ define i8 @select_icmp_var_start(ptr %a, i8 %n, i8 %start) {
9696
; CHECK-NEXT: [[SEL]] = select i1 [[C]], i8 [[IV1]], i8 [[RDX]]
9797
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i8 [[IV1]], 1
9898
; CHECK-NEXT: [[EC:%.*]] = icmp eq i8 [[IV_NEXT]], [[N]]
99-
; CHECK-NEXT: br i1 [[EC]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP5:![0-9]+]]
99+
; CHECK-NEXT: br i1 [[EC]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP4:![0-9]+]]
100100
; CHECK: [[EXIT]]:
101101
; CHECK-NEXT: [[SEL_LCSSA:%.*]] = phi i8 [ [[SEL]], %[[LOOP]] ], [ [[RDX_SELECT]], %[[MIDDLE_BLOCK]] ], [ [[RDX_SELECT15]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ]
102102
; CHECK-NEXT: ret i8 [[SEL_LCSSA]]
@@ -158,7 +158,7 @@ define i32 @select_icmp_var_start_iv_trunc(i32 %N, i32 %start) #0 {
158158
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16
159159
; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[STEP_ADD_3]], splat (i32 4)
160160
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
161-
; CHECK-NEXT: br i1 [[TMP7]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]
161+
; CHECK-NEXT: br i1 [[TMP7]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]]
162162
; CHECK: [[MIDDLE_BLOCK]]:
163163
; CHECK-NEXT: [[RDX_MINMAX:%.*]] = call <4 x i32> @llvm.smax.v4i32(<4 x i32> [[TMP3]], <4 x i32> [[TMP4]])
164164
; CHECK-NEXT: [[RDX_MINMAX5:%.*]] = call <4 x i32> @llvm.smax.v4i32(<4 x i32> [[RDX_MINMAX]], <4 x i32> [[TMP5]])
@@ -170,7 +170,7 @@ define i32 @select_icmp_var_start_iv_trunc(i32 %N, i32 %start) #0 {
170170
; CHECK-NEXT: br i1 [[CMP_N]], label %[[EXIT:.*]], label %[[VEC_EPILOG_ITER_CHECK:.*]]
171171
; CHECK: [[VEC_EPILOG_ITER_CHECK]]:
172172
; CHECK-NEXT: [[MIN_EPILOG_ITERS_CHECK:%.*]] = icmp ult i64 [[N_MOD_VF]], 4
173-
; CHECK-NEXT: br i1 [[MIN_EPILOG_ITERS_CHECK]], label %[[VEC_EPILOG_SCALAR_PH]], label %[[VEC_EPILOG_PH]], !prof [[PROF7:![0-9]+]]
173+
; CHECK-NEXT: br i1 [[MIN_EPILOG_ITERS_CHECK]], label %[[VEC_EPILOG_SCALAR_PH]], label %[[VEC_EPILOG_PH]]
174174
; CHECK: [[VEC_EPILOG_PH]]:
175175
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], %[[VEC_EPILOG_ITER_CHECK]] ], [ 0, %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
176176
; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi i32 [ [[RDX_SELECT]], %[[VEC_EPILOG_ITER_CHECK]] ], [ [[FR]], %[[VECTOR_MAIN_LOOP_ITER_CHECK]] ]
@@ -197,7 +197,7 @@ define i32 @select_icmp_var_start_iv_trunc(i32 %N, i32 %start) #0 {
197197
; CHECK-NEXT: [[INDEX_NEXT17]] = add nuw i64 [[INDEX11]], 4
198198
; CHECK-NEXT: [[VEC_IND_NEXT16]] = add <4 x i32> [[VEC_IND15]], splat (i32 4)
199199
; CHECK-NEXT: [[TMP15:%.*]] = icmp eq i64 [[INDEX_NEXT17]], [[N_VEC8]]
200-
; CHECK-NEXT: br i1 [[TMP15]], label %[[VEC_EPILOG_MIDDLE_BLOCK:.*]], label %[[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]
200+
; CHECK-NEXT: br i1 [[TMP15]], label %[[VEC_EPILOG_MIDDLE_BLOCK:.*]], label %[[VEC_EPILOG_VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]
201201
; CHECK: [[VEC_EPILOG_MIDDLE_BLOCK]]:
202202
; CHECK-NEXT: [[TMP16:%.*]] = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> [[TMP14]])
203203
; CHECK-NEXT: [[RDX_SELECT_CMP18:%.*]] = icmp ne i32 [[TMP16]], -2147483648
@@ -216,7 +216,7 @@ define i32 @select_icmp_var_start_iv_trunc(i32 %N, i32 %start) #0 {
216216
; CHECK-NEXT: [[RED_NEXT]] = select i1 [[C]], i32 [[IV_TRUNC]], i32 [[RED]]
217217
; CHECK-NEXT: [[IV_NEXT]] = add i64 [[IV]], 1
218218
; CHECK-NEXT: [[EC:%.*]] = icmp eq i64 [[IV]], [[N_EXT]]
219-
; CHECK-NEXT: br i1 [[EC]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP9:![0-9]+]]
219+
; CHECK-NEXT: br i1 [[EC]], label %[[EXIT]], label %[[LOOP]], !llvm.loop [[LOOP7:![0-9]+]]
220220
; CHECK: [[EXIT]]:
221221
; CHECK-NEXT: [[RED_NEXT_LCSSA:%.*]] = phi i32 [ [[RED_NEXT]], %[[LOOP]] ], [ [[RDX_SELECT]], %[[MIDDLE_BLOCK]] ], [ [[RDX_SELECT19]], %[[VEC_EPILOG_MIDDLE_BLOCK]] ]
222222
; CHECK-NEXT: ret i32 [[RED_NEXT_LCSSA]]

0 commit comments

Comments
 (0)