[llvm] [VPlan] Move call widening decision to VPlan. (NFCI) (PR #195518)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 03:49:59 PDT 2026


================
@@ -6548,3 +6552,177 @@ void VPlanTransforms::makeScalarizationDecisions(VPlan &Plan, VFRange &Range) {
     }
   }
 }
+
+/// Returns true if \p Info's parameter kinds are compatible with \p Args.
+static bool areVFParamsOk(const VFInfo &Info, ArrayRef<VPValue *> Args,
+                          PredicatedScalarEvolution &PSE, const Loop *L) {
+  return all_of(Info.Shape.Parameters, [&](VFParameter Param) {
+    switch (Param.ParamKind) {
+    case VFParamKind::Vector:
+    case VFParamKind::GlobalPredicate:
+      return true;
+    case VFParamKind::OMP_Uniform:
+      return PSE.getSE()->isLoopInvariant(
+          vputils::getSCEVExprForVPValue(Args[Param.ParamPos], PSE, L), L);
+    case VFParamKind::OMP_Linear:
+      return match(vputils::getSCEVExprForVPValue(Args[Param.ParamPos], PSE, L),
+                   m_scev_AffineAddRec(
+                       m_SCEV(), m_scev_SpecificSInt(Param.LinearStepOrPos),
+                       m_SpecificLoop(L)));
----------------
artagnon wrote:

I think the m_SpecificLoop is unnecessary with https://github.com/llvm/llvm-project/pull/195818 -- PSE should operate on the underlying Loop? Could also add a PSE::isLoopInvariant helper to avoid the misleading Loop argument, when PSE is already supplied?

Not a blocker, and can be cleaned up later though? Would be useful in outer-loop vectorization?

https://github.com/llvm/llvm-project/pull/195518


More information about the llvm-commits mailing list