[llvm] [RISCV] Use two ADDIs to do some stack pointer adjustments for special case (PR #94182)

Liao Chunyu via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 06:07:54 PDT 2024


================
@@ -511,16 +511,27 @@ bool RISCVRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
       // We can encode an add with 12 bit signed immediate in the immediate
       // operand of our user instruction.  As a result, the remaining
       // offset can by construction, at worst, a LUI and a ADD.
+
+      // Special case, try to split the offset across two ADDIs.
+      uint64_t ValSubLo12 = (uint64_t)Val - (uint64_t)Lo12;
----------------
ChunyuLiao wrote:

The argument of adjustReg `MaybeAlign RequiredAlign` is std::nullopt, so there maybe no need to compute alignment here.
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp#L527

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


More information about the llvm-commits mailing list