Skip to content

Commit 73e2beb

Browse files
committed
!fixup address latest comments, thanks
1 parent 83e933a commit 73e2beb

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9414,6 +9414,9 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
94149414
Builder.setInsertPoint(VPBB, VPBB->getFirstNonPhi());
94159415
RecipeBuilder.createHeaderMask();
94169416
} else if (NeedsMasks) {
9417+
// FIXME: At the moment, masks need to be placed at the beginning of the
9418+
// block, as blends introduced for phi nodes need to use it. The created
9419+
// blends should be sunk after the mask recipes.
94179420
RecipeBuilder.createBlockInMask(HCFGBuilder.getIRBBForVPB(VPBB));
94189421
}
94199422

@@ -9423,22 +9426,22 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
94239426
auto *UnderlyingValue = SingleDef->getUnderlyingValue();
94249427
// Skip recipes that do not need transforming, including canonical IV,
94259428
// wide canonical IV and VPInstructions without underlying values. The
9426-
// latter are added above by masking.
9429+
// latter are added above for masking.
94279430
// FIXME: Migrate code relying on the underlying instruction from VPlan0
94289431
// to construct recipes below to not use the underlying instruction.
9429-
if (isa<VPCanonicalIVPHIRecipe, VPWidenCanonicalIVRecipe>(SingleDef) ||
9432+
if (isa<VPCanonicalIVPHIRecipe, VPWidenCanonicalIVRecipe>(&R) ||
94309433
(isa<VPInstruction>(&R) && !UnderlyingValue))
94319434
continue;
94329435

94339436
// FIXME: VPlan0, which models a copy of the original scalar loop, should
94349437
// not use VPWidenPHIRecipe to model the phis.
9435-
assert(
9436-
(isa<VPWidenPHIRecipe>(SingleDef) || isa<VPInstruction>(SingleDef)) &&
9437-
UnderlyingValue && "unsupported recipe");
9438+
assert((isa<VPWidenPHIRecipe>(&R) || isa<VPInstruction>(&R)) &&
9439+
UnderlyingValue && "unsupported recipe");
94389440

9439-
if (match(&R, m_BranchOnCond(m_VPValue())) ||
9440-
(isa<VPInstruction>(&R) &&
9441-
cast<VPInstruction>(&R)->getOpcode() == Instruction::Switch)) {
9441+
if (isa<VPInstruction>(&R) &&
9442+
(cast<VPInstruction>(&R)->getOpcode() ==
9443+
VPInstruction::BranchOnCond ||
9444+
(cast<VPInstruction>(&R)->getOpcode() == Instruction::Switch))) {
94429445
R.eraseFromParent();
94439446
break;
94449447
}
@@ -9498,7 +9501,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
94989501

94999502
// Flatten the CFG in the loop. Masks for blocks have already been generated
95009503
// and added to recipes as needed. To do so, first disconnect VPBB from its
9501-
// successors. Then connect VPBB to the previously visited$ VPBB.
9504+
// successors. Then connect VPBB to the previously visited VPBB.
95029505
for (auto *Succ : to_vector(VPBB->getSuccessors()))
95039506
VPBlockUtils::disconnectBlocks(VPBB, Succ);
95049507
if (PrevVPBB)

llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ class VPlanHCFGBuilder {
6969

7070
/// Return the input IR BasicBlock corresponding to \p VPB. Returns nullptr if
7171
/// there is no such corresponding block.
72+
/// FIXME: This is a temporary workaround to drive the createBlockInMask.
73+
/// Remove once mask creation is done on VPlan.
7274
BasicBlock *getIRBBForVPB(const VPBlockBase *VPB) const {
7375
return VPB2IRBB.lookup(VPB);
7476
}

0 commit comments

Comments
 (0)