[PATCH] D126392: [RISCV] Use two ADDIs to do some stack pointer adjustments.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 13:39:01 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:309
 
-    Register ScratchReg = MRI.createVirtualRegister(&RISCV::GPRRegClass);
-    TII->movImm(MBB, MBBI, DL, ScratchReg, Val, Flag);
-    BuildMI(MBB, MBBI, DL, TII->get(Opc), DestReg)
+  // Try to split the offset across two ADDIs. We need make sure we keep the
+  // stack pointer aligned after each ADDI. We need to determine the maximum
----------------
Is there anything here that guarantees stack alignment must be smaller than 12 bits?  If not, I don't think your statement about -2048 always being aligned holds.  

On the positive vs negative direction, shouldn't we always be able to use the same constant by simply swapping the ADD for a SUB?  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126392



More information about the llvm-commits mailing list