[PATCH] D69385: [RISCV] Fix CFA when doing split sp adjustment with fp

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 02:21:07 PDT 2019


luismarques marked 4 inline comments as done.
luismarques added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:267
 
     adjustReg(MBB, LastFrameDestroy, DL, SPReg, SPReg, SecondSPAdjustAmount,
               MachineInstr::FrameDestroy);
----------------
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!


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