[llvm] [LV] Make ScalarEpilogue a LoopVectorizeHint (PR #160125)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 22 10:40:53 PDT 2025
artagnon wrote:
> > > > as it is really a kind of hint that's dependent on the user's preferences
> >
> >
> > >
> >
> >
> > > Aren't loop hints for loop pragmas etc? I don't think the user can control whether or not a scalar epilogue is emitted on a loop by loop basis. `-prefer-predicate-over-epilogue` is more of a TTI override
> >
> >
> > Hm, by that reasoning isn't ForceScalableVectorization, which is also a hint, also a TTI override?
>
> The TTI only controls the default. ForceScalableVectorization comes from `#pragma clang loop vectorize_width(4, scalable)` IIRC.
Ah, I see. I didn't know about that pragma. Though, not all the hints correspond to pragmas: IsVectorized is metadata, for instance. It is true that I'm introducing a new metadata control with the patch, but that's an unintended side-effect of the patch: the main motivation behind the patch is to improve code, consolidate related options, and expose the option outside LV.cpp: I'm planning to follow-up with also exposing tail-folding, which would allow VPlan to reason about tail-folding, in a way that's independent of the legacy CM.
I agree though that the unintended side-effect should make sense. Would you suggest moving ScalarEpilogue into LVLegality instead? Do you see a way forward for exposing tail-folding preferences in VPlan? I initially tried exposing LVCostModel, but Florian said that exposing the legacy CM would be undesirable.
https://github.com/llvm/llvm-project/pull/160125
More information about the llvm-commits
mailing list