[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

Lewis Revill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 04:10:36 PST 2019


lewis-revill marked an inline comment as done.
lewis-revill added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:667
+        .addExternalSymbol(SpillLibCall, RISCVII::MO_CALL)
+        .setMIFlag(MachineInstr::FrameSetup);
+
----------------
shiva0217 wrote:
> There is a case may trigger an assertion when compile with -O3 -g -msave-restore if the libcall has FrameSetup flag.
>   int main(int a, char* argv[]) {
>     exit(0);
>     return 0;
>   }
Think I've found the cause of this. When 'DIFlagAllCallsDescribed' is set for the module LLVM attempts to provide call entry info DIEs for all calls, //including// this one that has been added by us. One detail of this is attempting to calculate the return PC value or offset for the call using a label that was assumed to be inserted after the call instruction.

However, while the attempt to add the call entry info doesn't check for the FrameSetup flag, the label was never inserted, since that code //does// check for the flag. Adding the missing check to avoid adding call entry info for calls marked as FrameSetup fixed this issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686





More information about the llvm-commits mailing list