[llvm] [Analysis][RISCV] More accurately estimate the cost of strided vector loads (PR #175135)

Ryan Buchner via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 13:57:44 PDT 2026


================

----------------
bababuck wrote:

Yes, I think
```
NumLoads = (Stride * NumberOfElements + (CacheLineSize - 1)) / CacheLineSize
         = divideCeil(Stride * NumberOfElements, CacheLineSize)
```

Though for the element size, I think it starts to matter if we were to consider misalignment (i.e. where a single element can cross cache lines). But as far as I can tell, the scalar loads don't consider that when costing, since scalar loads/stores are given a cost of `1`, though I would expect a scalar load/store that crosses cache lines would cost more than `1`, though maybe microarchitectures can cover most of that latency for stores with a store buffer.

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


More information about the llvm-commits mailing list