[PATCH] D110933: [RISCV] Add a test showing incorrect RVV stack alignment

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 03:37:18 PDT 2022


frasercrmck added a comment.

In D110933#3042262 <https://reviews.llvm.org/D110933#3042262>, @StephenFan wrote:

> Yes. But I didn't understand why we need to alignTo(VLENB, 32) rather than just alignTo(32) ? The alignment of vector register is always 8, and the alloca instruction is not related to vector register.

Sorry I never replied - I had to switch focus for a (long) while. I'm now getting back to fixing this bug.

By `alignTo(VLENB, 32)` I was trying to capture the notion that in my example we're dynamically rounding up the size of a vector to the next object's alignment, so that we can address it when multiple vector objects are in contention. I was assuming that the base pointer is aligned to the maximum alignment. So Object #0 (closest to bp) is aligned by the bp. Object #1 must be aligned to 32 but is also offset by the size of Object #0 which is of size `VLENB`. So if `VLENB` not aligned to 32 (i.e., in practice it is smaller than 32 - anything larger is automatically aligned as it's a power of 2) it needs to be rounded up to 32 - if it's larger we need to skip ahead by `VLENB` instead. Maybe my notation was confusing. Or maybe I misunderstood you?

I'm not sure if this is what we actually want to do, at least in the initial version - I was just prototyping ideas.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110933/new/

https://reviews.llvm.org/D110933



More information about the llvm-commits mailing list