djtodoro wrote: This looks good to me. > Do we need to be careful in the load/store optimisation pass too? I would additional guard into the `RISCVSubtarget::useLoadStorePairs()` predicate for this as well. https://github.com/llvm/llvm-project/pull/227043