[PATCH] D126465: [RISCV] Use knowledge of VLEN to avoid over-aligning the stack

Fraser Cormack via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 07:09:03 PDT 2022


frasercrmck created this revision.
frasercrmck added reviewers: rogfer01, HsiangKai, StephenFan, kito-cheng, craig.topper, reames.
Herald added subscribers: sunshaoce, VincentWu, luke957, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson, qcolombet.
Herald added a project: All.
frasercrmck requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

With D125787 <https://reviews.llvm.org/D125787>, the size of the RVV portion of the stack is a
16-byte-aligned to help maintain the overall alignment of the stack as a
whole. Alignments of the RVV objects themselves are also correctly
aligned.

The naive implementation in that patch ensured these alignments while
ignoring the effect that the implicit multiplication by VLENB has on
alignment. Since VLEN is a power of two we often take on extra
alignment when calculating the final object offsets.

This patch now takes VLEN into account when calculating RVV object
offsets by reducing the required alignment by the known 8-byte multiple
we receive from VLEN.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126465

Files:
  llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
  llvm/lib/Target/RISCV/RISCVFrameLowering.h
  llvm/test/CodeGen/RISCV/rvv/access-fixed-objects-by-rvv.ll
  llvm/test/CodeGen/RISCV/rvv/addi-scalable-offset.mir
  llvm/test/CodeGen/RISCV/rvv/allocate-lmul-2-4-8.ll
  llvm/test/CodeGen/RISCV/rvv/emergency-slot.mir
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vpscatter.ll
  llvm/test/CodeGen/RISCV/rvv/no-reserved-frame.ll
  llvm/test/CodeGen/RISCV/rvv/rv32-spill-vector.ll
  llvm/test/CodeGen/RISCV/rvv/rv32-spill-zvlsseg.ll
  llvm/test/CodeGen/RISCV/rvv/rv64-spill-vector.ll
  llvm/test/CodeGen/RISCV/rvv/rv64-spill-zvlsseg.ll
  llvm/test/CodeGen/RISCV/rvv/rvv-framelayout.ll
  llvm/test/CodeGen/RISCV/rvv/rvv-stack-align.mir
  llvm/test/CodeGen/RISCV/rvv/scalar-stack-align.ll
  llvm/test/CodeGen/RISCV/rvv/wrong-stack-offset-for-rvv-object.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126465.432271.patch
Type: text/x-patch
Size: 45487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220526/96903190/attachment-0001.bin>


More information about the llvm-commits mailing list