[llvm] [VPlan] Lower safe uniform load to unconditional scalar load (PR #216767)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 23:06:38 PDT 2026


lukel97 wrote:

> And the backend can convert them if the target supports optimized zero-stride loads.

I think we should try and do as much of this conversion as possible in VPlan since it makes the cost model more accurate. As an aside, we probably need to hook getStridedMemoryOpCost up to TuneOptimizedZeroStrideLoad with a hint. 

> This optimization seems to be useful on HW without native strided memory ops, so I'm not sure we should tie it there. 

Yup I'm not saying we should never convert to scalar loads, but I think it should be cost model driven in case the hardware does have optimized strided loads which can prevent a scalar->vector domain crossing. I think the sifive x280 and tenstorrent cores optimize for this. E.g. see vlse8.v v8,(t2),x0 on https://camel-cdr.github.io/rvv-bench-results/tt_asc_x/index.html

But maybe we should just eagerly lower the safe uniform loads to scalar loads early, and then have a separate transform to convertToStridedAccesses that converts scalar loads that are broadcasted to vp.strided.loads. I'll try and think about this a bit more.

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


More information about the llvm-commits mailing list