[PATCH] D62190: [RISCV] Allow shrink wrapping for RISC-V

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 23:25:39 PDT 2019


shiva0217 added inline comments.
Herald added a subscriber: pzheng.


================
Comment at: lib/Target/RISCV/RISCVFrameLowering.cpp:171
                                       MachineBasicBlock &MBB) const {
   MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr();
   const RISCVRegisterInfo *RI = STI.getRegisterInfo();
----------------
We might need to consider that there're two branches at the end of the basic block. Last non-debug instruction is PseudoBr which is a terminator. So the epilogue will be inserted between the branches. 
  BEQ killed renamable $x10, $x0, %bb.3
  PseudoBR %bb.2
Replacing by 
  MachineBasicBlock::iterator MBBI = MBB.getFirstTerminator();
could handle the case. and 
  if (MBBI == MBB.end())
    MBBI = MBB.getLastNonDebugInstr();
to handle that there is no terminator in the basic block.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62190





More information about the llvm-commits mailing list