[llvm] [LV] Implement integer part of VPDerivedIV cost model (PR #198252)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 01:49:57 PDT 2026


david-arm wrote:

> @david-arm did you get around to landing a fix for the regression?
> 
> If not yet, I think something like #228252 may help

I looked at trying to fix this in the cost model, but it also seemed rather hacky and fragile, likely to cause breakages elsewhere. The problem is that in `AArch64::getInterleavedMemoryOpCost` you can't just do a hack like

```
  if (Factor == 5) {
     Cost -= 1;
  }
```

which is clearly tailored towards saxpy_5 and instead you have to come up with a cost model that is genuinely better than `BaseT::getInterleavedMemoryOpCost` for all cases, and reflects the actual codegen for each sub-vector type and element width. It turns out to be extremely difficult to get right for each case without simply introducing a massive table of costs. A factor-5 interleave load with <2 x i64> subvectors is quite trivial, but as soon as you move to smaller element types, e.g. <4 x i32>, etc. it becomes fiendishly difficult to model sensibly especially for <8 x i16> that involves lots of literal loads, tbl and bsl instructions. I figured that trying to coerce the cost model into vectorising this one loop would probably just introduce regressions elsewhere.

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


More information about the llvm-commits mailing list