[llvm] f66509b - [VPlan] Clarify comment for replaceVPBBWithIRVPBB and add assert (NFCI).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 14 13:51:51 PDT 2024
Author: Florian Hahn
Date: 2024-09-14T21:51:19+01:00
New Revision: f66509bf524aaa7008591f7b8a0a32e239d59c01
URL: https://github.com/llvm/llvm-project/commit/f66509bf524aaa7008591f7b8a0a32e239d59c01
DIFF: https://github.com/llvm/llvm-project/commit/f66509bf524aaa7008591f7b8a0a32e239d59c01.diff
LOG: [VPlan] Clarify comment for replaceVPBBWithIRVPBB and add assert (NFCI).
Follow-up to suggestion during
https://github.com/llvm/llvm-project/pull/100735.
More specifically
https://github.com/llvm/llvm-project/pull/100735/files/9a40ed0919bad7fb79123317267d3eb36ff2c582#diff-6d0b73adfa9f8465923d2225ab6674ddcdeab71666f7a73dfaec7fa1246b3a1f
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index e6c7bec873a013..2655337fdf6f64 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -976,13 +976,15 @@ void VPlan::prepareToExecute(Value *TripCountV, Value *VectorTripCountV,
}
/// Replace \p VPBB with a VPIRBasicBlock wrapping \p IRBB. All recipes from \p
-/// VPBB are moved to the newly created VPIRBasicBlock. VPBB must have a single
-/// predecessor, which is rewired to the new VPIRBasicBlock. All successors of
-/// VPBB, if any, are rewired to the new VPIRBasicBlock.
+/// VPBB are moved to the end of the newly created VPIRBasicBlock. VPBB must
+/// have a single predecessor, which is rewired to the new VPIRBasicBlock. All
+/// successors of VPBB, if any, are rewired to the new VPIRBasicBlock.
static void replaceVPBBWithIRVPBB(VPBasicBlock *VPBB, BasicBlock *IRBB) {
VPIRBasicBlock *IRMiddleVPBB = createVPIRBasicBlockFor(IRBB);
- for (auto &R : make_early_inc_range(*VPBB))
+ for (auto &R : make_early_inc_range(*VPBB)) {
+ assert(!R.isPhi() && "Tried to move phi recipe to end of block");
R.moveBefore(*IRMiddleVPBB, IRMiddleVPBB->end());
+ }
VPBlockBase *PredVPBB = VPBB->getSinglePredecessor();
VPBlockUtils::disconnectBlocks(PredVPBB, VPBB);
VPBlockUtils::connectBlocks(PredVPBB, IRMiddleVPBB);
More information about the llvm-commits
mailing list