[llvm] [LoopVectorize] Widen selected-base loads with masked loads (PR #213227)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 07:55:54 PDT 2026
================
@@ -57,6 +57,93 @@ static std::optional<int64_t> getConstantStride(VPValue *Addr, Type *AccessTy,
return getStrideFromAddRec(AddRec, L, AccessTy, /*Ptr=*/nullptr, PSE);
}
+namespace {
+
+struct SelectedBaseLoadPattern {
+ VPInstruction *Addr;
+ SmallVector<VPValue *> GEPOperands;
+ VPValue *Cond;
+ VPValue *TrueBase;
+ VPValue *FalseBase;
+};
+
+/// Match a load through a GEP whose base pointer is selected per iteration
+/// between two loop-invariant candidates:
+///
+/// load (gep (select Cond, TrueBase, FalseBase), Indices...)
+///
+/// Legality, stride and profitability are checked separately by the caller.
+static std::optional<SelectedBaseLoadPattern>
----------------
david-arm wrote:
Pattern matches are typically added to VPlanPatternMatchers.h
https://github.com/llvm/llvm-project/pull/213227
More information about the llvm-commits
mailing list