Skip to content

Commit c4fc27c

Browse files
authored
[VPlan] Strip pred-block check in inLoopReductions (NFC) (#194086)
A VPInstruction will only have a mask if the block needs predication.
1 parent 8ee61ad commit c4fc27c

3 files changed

Lines changed: 5 additions & 18 deletions

File tree

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6997,14 +6997,8 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VPlanPtr Plan,
69976997
ReversePostOrderTraversal<VPBlockShallowTraversalWrapper<VPBlockBase *>> RPOT(
69986998
HeaderVPBB);
69996999

7000-
// Collect blocks that need predication for in-loop reduction recipes.
7001-
DenseSet<BasicBlock *> BlocksNeedingPredication;
7002-
for (BasicBlock *BB : OrigLoop->blocks())
7003-
if (CM.blockNeedsPredicationForAnyReason(BB))
7004-
BlocksNeedingPredication.insert(BB);
7005-
70067000
RUN_VPLAN_PASS(VPlanTransforms::createInLoopReductionRecipes, *Plan,
7007-
BlocksNeedingPredication, Range.Start);
7001+
Range.Start);
70087002

70097003
VPCostContext CostCtx(CM.TTI, *CM.TLI, *Plan, CM, Config.CostKind, CM.PSE,
70107004
OrigLoop);

llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -993,9 +993,8 @@ bool VPlanTransforms::createHeaderPhiRecipes(
993993
return true;
994994
}
995995

996-
void VPlanTransforms::createInLoopReductionRecipes(
997-
VPlan &Plan, const DenseSet<BasicBlock *> &BlocksNeedingPredication,
998-
ElementCount MinVF) {
996+
void VPlanTransforms::createInLoopReductionRecipes(VPlan &Plan,
997+
ElementCount MinVF) {
999998
VPTypeAnalysis TypeInfo(Plan);
1000999
VPBasicBlock *Header = Plan.getVectorLoopRegion()->getEntryBasicBlock();
10011000
SmallVector<VPRecipeBase *> ToDelete;
@@ -1124,13 +1123,9 @@ void VPlanTransforms::createInLoopReductionRecipes(
11241123
"PreviousLink must be the operand other than VecOp");
11251124
}
11261125

1127-
// Get block mask from CurrentLink, if it needs predication.
1128-
VPValue *CondOp = nullptr;
1129-
if (BlocksNeedingPredication.contains(CurrentLinkI->getParent()))
1130-
CondOp = cast<VPInstruction>(CurrentLink)->getMask();
1131-
11321126
assert(PhiR->getVFScaleFactor() == 1 &&
11331127
"inloop reductions must be unscaled");
1128+
VPValue *CondOp = cast<VPInstruction>(CurrentLink)->getMask();
11341129
auto *RedRecipe = new VPReductionRecipe(
11351130
Kind, FMFs, CurrentLinkI, PreviousLink, VecOp, CondOp,
11361131
getReductionStyle(/*IsInLoop=*/true, PhiR->isOrdered(), 1),

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ struct VPlanTransforms {
149149
/// Create VPReductionRecipes for in-loop reductions. This processes chains
150150
/// of operations contributing to in-loop reductions and creates appropriate
151151
/// VPReductionRecipe instances.
152-
static void createInLoopReductionRecipes(
153-
VPlan &Plan, const DenseSet<BasicBlock *> &BlocksNeedingPredication,
154-
ElementCount MinVF);
152+
static void createInLoopReductionRecipes(VPlan &Plan, ElementCount MinVF);
155153

156154
/// Update \p Plan to account for all early exits. If \p Style is not
157155
/// NoUncountableExit, handles uncountable early exits and checks that all

0 commit comments

Comments
 (0)