[PATCH] D69385: [RISCV] Fix CFA when doing split sp adjustment with fp
Shiva Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 04:49:34 PDT 2019
shiva0217 accepted this revision.
shiva0217 added a comment.
This revision is now accepted and ready to land.
Hi @luismarques, thanks for the patch, LGTM.
================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:267
adjustReg(MBB, LastFrameDestroy, DL, SPReg, SPReg, SecondSPAdjustAmount,
MachineInstr::FrameDestroy);
----------------
luismarques wrote:
> shiva0217 wrote:
> > It seems that we might be able to reduce the epilogue instructions if the FP exists. Something like:
> >
> >
> > if (hasFP(MF) && !isInt<12>(SecondSPAdjustAmount)) {
> > adjustReg(MBB, LastFrameDestroy, DL, SPReg, FPReg,-FirstSPAdjustAmount + RVFI->getVarArgsSaveSize(), MachineInstr::FrameDestroy);
> > } else {
> > adjustReg(MBB, LastFrameDestroy, DL, SPReg, SPReg, SecondSPAdjustAmount, MachineInstr::FrameDestroy);
> > // Emit ".cfi_def_cfa_offset FirstSPAdjustAmount"
> > unsigned CFIIndex = MF.addFrameInst(
> > MCCFIInstruction::createDefCfaOffset(nullptr, -FirstSPAdjustAmount));
> > BuildMI(MBB, LastFrameDestroy, DL,
> > TII->get(TargetOpcode::CFI_INSTRUCTION))
> > .addCFIIndex(CFIIndex);
> > }
> I would prefer to do codegen improvements in a separate patch. Thanks for the suggestion!
Ok, that makes sense.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69385/new/
https://reviews.llvm.org/D69385
More information about the llvm-commits
mailing list