[llvm] [VPlan] Connect (MemRuntime|SCEV)Check blocks as VPlan transform (NFC). (PR #143879)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 02:50:09 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h llvm/lib/Transforms/Vectorize/LoopVectorize.cpp llvm/lib/Transforms/Vectorize/VPlan.cpp llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp llvm/lib/Transforms/Vectorize/VPlanTransforms.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index b2bf723ac..a634a670a 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2011,7 +2011,7 @@ public:
return {nullptr, nullptr};
AddedAnyChecks = true;
- return {SCEVCheckCond , SCEVCheckBlock};
+ return {SCEVCheckCond, SCEVCheckBlock};
}
/// Adds the generated MemCheckBlock before \p LoopVectorPreHeader and adjusts
@@ -7512,7 +7512,9 @@ EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton() {
EPI.EpilogueIterationCountCheck->getTerminator()->replaceUsesOfWith(
VecEpilogueIterationCountCheck, LoopScalarPreHeader);
- // Retrieve blocks with SCEV and memory runtime checks, if they have been connected to the CFG, otherwise they are unused and will be deleted. Their terminators and phis using them need adjusting below.
+ // Retrieve blocks with SCEV and memory runtime checks, if they have been
+ // connected to the CFG, otherwise they are unused and will be deleted. Their
+ // terminators and phis using them need adjusting below.
BasicBlock *SCEVCheckBlock = RTChecks.getSCEVCheckBlock();
if (SCEVCheckBlock && pred_empty(SCEVCheckBlock))
SCEVCheckBlock = nullptr;
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index ef93def15..3b629b42e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -487,8 +487,11 @@ void VPBasicBlock::connectToPredecessors(VPTransformState &State) {
} else {
// Set each forward successor here when it is created, excluding
// backedges. A backward successor is set when the branch is created.
- // Branches to VPIRBasicBlocks must have the same successors in VPlan as in the original IR, except if the predecessors is the entry block. This enables including SCEV and memory runtime check blocks in VPlan.
- // TODO: Remove exception by modeling branch in the entry block using BranchOnCond.
+ // Branches to VPIRBasicBlocks must have the same successors in VPlan as
+ // in the original IR, except if the predecessors is the entry block. This
+ // enables including SCEV and memory runtime check blocks in VPlan.
+ // TODO: Remove exception by modeling branch in the entry block using
+ // BranchOnCond.
unsigned idx = PredVPSuccessors.front() == this ? 0 : 1;
assert((TermBr && (!TermBr->getSuccessor(idx) ||
(isa<VPIRBasicBlock>(this) &&
diff --git a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
index c8d279666..1f594260c 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
@@ -591,7 +591,8 @@ void VPlanTransforms::createLoopRegions(VPlan &Plan) {
TopRegion->getEntryBasicBlock()->setName("vector.body");
}
-// Likelyhood of bypassing the vectorized loop due to SCEV or memory runtime checks.
+// Likelyhood of bypassing the vectorized loop due to SCEV or memory runtime
+// checks.
static constexpr uint32_t CheckBypassWeights[] = {1, 127};
void VPlanTransforms::connectCheckBlocks(
``````````
</details>
https://github.com/llvm/llvm-project/pull/143879
More information about the llvm-commits
mailing list