[llvm] [VPlan] Model first memory runtime checks as VPlan recipes. (PR #221483)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 15:47:56 PDT 2026
================
@@ -1541,13 +1494,55 @@ void VPlanTransforms::attachCheckBlock(VPlan &Plan, Value *Cond,
attachVPCheckBlock(Plan, CondVPV, CheckBlockVPBB, AddBranchWeights);
}
+void VPlanTransforms::addMemoryRuntimeChecks(
+ VPlan &Plan, ArrayRef<RuntimePointerCheck> Checks, ScalarEvolution &SE,
+ DebugLoc DL, bool AddBranchWeights) {
+ assert(!Checks.empty() && "no checks to replace the pre-built block with");
+
+ auto *MemCheckVPBB = Plan.createVPBasicBlock("vector.memcheck");
+ VPBuilder Builder(MemCheckVPBB);
+ insertCheckBlockBeforeVectorLoop(Plan, MemCheckVPBB);
+ VPSCEVExpander Expander(Builder, SE, DL);
+
+ // Expand each group's bounds once and up front.
+ SmallDenseMap<const RuntimeCheckingPtrGroup *,
+ std::pair<VPValue *, VPValue *>>
+ GroupToBounds;
----------------
artagnon wrote:
Hm, not too happy with this, and the transform itself: can we do something like what we did for VPSCEVExpander, and have a VPRuntimeCheckExpander, which would also have the benefit of seeing supported versus unsupported expansions (so the entire canModelMemoryChecksinVPlan would be absorbed)?
https://github.com/llvm/llvm-project/pull/221483
More information about the llvm-commits
mailing list