[llvm] [LV] Vectorize predicated loop-invariant loads via masked load + broadcast (PR #200361)

Ashutosh Nema via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 21:55:12 PDT 2026


nema-ashutosh wrote:

> It really seems like what you want here is actually a scalar predicated load. Maybe it's time to bite the bullet and implement that? Broadcasting out to the VF type, etc.. is rather arbitrary.

Thanks. The current lowering is a stand-in because VPlan has no single-scalar predicated load (predicated uniform loads still land in a replicate region).

The vector is only needed at uses: scalar predicated load of T, then Broadcast to VF x T

Do you want this PR to:
1: keep the VF-wide masked load + extract + splat (no new recipe), or
2: add a first-class scalar predicated load (result is scalar; splat only at vector uses)?

(2) looks like a larger follow-up. Happy to do it if that’s the preferred direction. @fhahn, any thoughts?


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


More information about the llvm-commits mailing list