Skip to content

Commit f66509b

Browse files
committed
[VPlan] Clarify comment for replaceVPBBWithIRVPBB and add assert (NFCI).
Follow-up to suggestion during #100735. More specifically https://github.com/llvm/llvm-project/pull/100735/files/9a40ed0919bad7fb79123317267d3eb36ff2c582#diff-6d0b73adfa9f8465923d2225ab6674ddcdeab71666f7a73dfaec7fa1246b3a1f
1 parent cfe3f5f commit f66509b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -976,13 +976,15 @@ void VPlan::prepareToExecute(Value *TripCountV, Value *VectorTripCountV,
976976
}
977977

978978
/// Replace \p VPBB with a VPIRBasicBlock wrapping \p IRBB. All recipes from \p
979-
/// VPBB are moved to the newly created VPIRBasicBlock. VPBB must have a single
980-
/// predecessor, which is rewired to the new VPIRBasicBlock. All successors of
981-
/// VPBB, if any, are rewired to the new VPIRBasicBlock.
979+
/// VPBB are moved to the end of the newly created VPIRBasicBlock. VPBB must
980+
/// have a single predecessor, which is rewired to the new VPIRBasicBlock. All
981+
/// successors of VPBB, if any, are rewired to the new VPIRBasicBlock.
982982
static void replaceVPBBWithIRVPBB(VPBasicBlock *VPBB, BasicBlock *IRBB) {
983983
VPIRBasicBlock *IRMiddleVPBB = createVPIRBasicBlockFor(IRBB);
984-
for (auto &R : make_early_inc_range(*VPBB))
984+
for (auto &R : make_early_inc_range(*VPBB)) {
985+
assert(!R.isPhi() && "Tried to move phi recipe to end of block");
985986
R.moveBefore(*IRMiddleVPBB, IRMiddleVPBB->end());
987+
}
986988
VPBlockBase *PredVPBB = VPBB->getSinglePredecessor();
987989
VPBlockUtils::disconnectBlocks(PredVPBB, VPBB);
988990
VPBlockUtils::connectBlocks(PredVPBB, IRMiddleVPBB);

0 commit comments

Comments
 (0)