[all-commits] [llvm/llvm-project] f68c68: [RISCV] Use max pushed register to get pushed regi...

Yeting Kuo via All-commits all-commits at lists.llvm.org
Wed Aug 2 23:49:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f68c6879ad0e08e6509b89f60ed436d3be409f9c
      https://github.com/llvm/llvm-project/commit/f68c6879ad0e08e6509b89f60ed436d3be409f9c
  Author: Yeting Kuo <yeting.kuo at sifive.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
    M llvm/test/CodeGen/RISCV/callee-saved-gprs.ll

  Log Message:
  -----------
  [RISCV] Use max pushed register to get pushed register number.

Previously we used the number of registers needed saved and pushable as the
number of pushed registers. We also use pushed register number to caculate
the stack size. It is not correct because Zcmp pushes registers from $ra to the
max register needed saved and there is no gurantee that the needed saved
registers are a sequenced list from $ra.

There is an example about that. PushPopRegs should be 6 (ra,s0 - s4)= instead of 1.
```
; llc -mtriple=riscv32 -mattr=+zcmp
define void @foo() {
entry:
; Old:    .cfi_def_cfa_offset 16
; New:    .cfi_def_cfa_offset 32
  tail call void asm sideeffect "li s4, 0", "~{s4}"()
  ret void
}
```

Reviewed By: Jim, kito-cheng

Differential Revision: https://reviews.llvm.org/D156407




More information about the All-commits mailing list