[PATCH] D150416: [RISCV] Add a pass to combine `cm.pop` and `ret` insts

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 16:08:17 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVPushPopOptimizer.cpp:140
+  // If frame pointer elimination has been disabled,
+  // abort to avoid breaking the ABI.
+  if (Fn.getTarget().Options.DisableFramePointerElim(Fn)) {
----------------
jrtc27 wrote:
> craig.topper wrote:
> > craig.topper wrote:
> > > How does it break the ABI?
> > This question was not answered.
> https://github.com/riscv/riscv-code-size-reduction/issues/194 and https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/18#issuecomment-1304496707 onwards
As far as I can tell, this patch just fuses the cm.pop with ret. Wouldn't the ABI break occur at the creation of cm.pop not at the formation of cm.popret?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150416



More information about the llvm-commits mailing list