[llvm] [RISCV] Handled the uimm9 offset while FrameIndex folding. (PR #149303)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 00:11:21 PDT 2025


topperc wrote:

> @topperc ,we traced out the PrologEpilogInsterter with gdb like
> 
> (gdb) p MI.dump() MIPS_PREFETCH %stack.0.data, 508, 8 :: (non-temporal "riscv-nontemporal-domain-bit-0" "riscv-nontemporal-domain-bit-1" load (s8) from %ir.ptr) $1 = void (gdb) n 578 if (Opc == RISCV::ADDI && !isInt<12>(Val)) { (gdb) n 585 } else if ((Opc == RISCV::PREFETCH_I || Opc == RISCV::PREFETCH_R || (gdb) n 590 } else if (Opc == RISCV::MIPS_PREFETCH && !isUInt<9>(Val)) { (gdb) s
> 
> (gdb) bt #0 llvm::MachineOperand::ChangeToImmediate (this=0x5555556a2748, ImmVal=0, TargetFlags=0) at llvm-project/llvm/lib/CodeGen/MachineOperand.cpp:162 #1 0x00007ffff76a94fa in llvm::RISCVRegisterInfo::eliminateFrameIndex (this=0x7fffef613338, II=..., SPAdj=0, FIOperandNum=0, RS=0x0) at /llvm-project/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp:593 #2 0x00007ffff4bcef09 in (anonymous namespace)::PEIImpl::replaceFrameIndicesBackward (this=0x7fffffffd200, BB=0x5555556a2570, MF=..., SPAdj=@0x7fffffffce7c: 0) at/llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:1502 #3 0x00007ffff4bce351 in (anonymous namespace)::PEIImpl::replaceFrameIndicesBackward (this=0x7fffffffd200, MF=...) at /llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:1359 #4 0x00007ffff4bc8b7f in (anonymous namespace)::PEIImpl::run (this=0x7fffffffd200, MF=...) at /llvm-project/llvm/lib/CodeGen/PrologEpilogInserter.cpp:284
> 
> here the offset "Val" is 508 ,which triggers the changes and fold the offset with ADDI.

Sorry I missed that your first test was changed when you pushed the new version.

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


More information about the llvm-commits mailing list