[llvm] [LV] Vectorize conditional scalar assignments (PR #158088)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 07:50:58 PST 2025


huntergr-arm wrote:

> > I will be doing some performance runs on AArch64 to figure out
> > the cost model, as we mostly regard vector selects as per-lane
> > instead of selecting the whole vector at once.
> 
> Did you already get a chance to run preliminary benchmarks? Would be very curious what the impact is, possibly for some microbenchmarks (https://github.com/llvm/llvm-test-suite/tree/main/MicroBenchmarks/LoopVectorization would be a good place)

So running with SVE enabled, we vectorize 7 loops in find-last.cpp from the test suite. I don't see any noticeable performance impact from the vectorization, but total execution time is on the order of a couple of milliseconds, so I maybe need to increase the amount of data for a microbenchmark to see anything.

That said, this is the more generic form of this reduction. I intend to follow this part up with an in-loop version of the reduction, so that targets with SVE can just use clastb inside the loop instead of maintaining the extra phi for the mask.

I'll try some spec runs and see if there's any interesting results there.

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


More information about the llvm-commits mailing list