[llvm] [VPlan] Add support for in-loop AnyOf reductions (PR #131830)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 18 11:05:37 PDT 2025


lukel97 wrote:

> > > > > The in-loop reductions may be completely not profitable
> > > > 
> > > > 
> > > > Yes, this is only profitable for EVL tail folding due to the vp.merge. The plan is to eventually use the TargetTransformInfo::preferInLoopReduction hook to only enable this for AnyOf reductions with EVL tail folding.
> > > 
> > > 
> > > I mean, the in-loop reduction may be (significantly!!!)less profitable than vp.merge.
> > 
> > 
> > The in-loop reduction should be a single vcpop.m which I think should be cheap on most microarchitecture?
> 
> Nope, it is not

Is there a specific microarchitecture that you can point to? RISCVSchedSiFive7.td and RISCVSchedSiFiveP600.td seem to imply that they are cheap/don't scale with VL. In any case we can disable it for a specific core in the hook.

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


More information about the llvm-commits mailing list