[llvm-branch-commits] [llvm] [LV] Mask off possibly aliasing vector lanes (PR #100579)
Florian Hahn via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Nov 21 02:13:04 PST 2025
================
@@ -8974,11 +8982,104 @@ void LoopVectorizationPlanner::attachRuntimeChecks(
assert((!CM.OptForSize ||
CM.Hints->getForce() == LoopVectorizeHints::FK_Enabled) &&
"Cannot SCEV check stride or overflow when optimizing for size");
- VPlanTransforms::attachCheckBlock(Plan, SCEVCheckCond, SCEVCheckBlock,
+ VPlanTransforms::attachCheckBlock(Plan, Plan.getOrAddLiveIn(SCEVCheckCond),
+ Plan.createVPIRBasicBlock(SCEVCheckBlock),
HasBranchWeights);
}
const auto &[MemCheckCond, MemCheckBlock] = RTChecks.getMemRuntimeChecks();
if (MemCheckBlock && MemCheckBlock->hasNPredecessors(0)) {
+ VPValue *MemCheckCondVPV = Plan.getOrAddLiveIn(MemCheckCond);
+ VPBasicBlock *MemCheckBlockVP = Plan.createVPIRBasicBlock(MemCheckBlock);
+ std::optional<ArrayRef<PointerDiffInfo>> ChecksOpt =
+ CM.Legal->getRuntimePointerChecking()->getDiffChecks();
+
+ // Create a mask enabling safe elements for each iteration.
+ if (CM.getRTCheckStyle(TTI) == RTCheckStyle::UseSafeEltsMask &&
----------------
fhahn wrote:
would be good to outline to a separte function + document the transform
https://github.com/llvm/llvm-project/pull/100579
More information about the llvm-branch-commits
mailing list