[PATCH] D146191: [MachineOutliner][MCP][RISCV] Don't run MCP on outlined functions

Wang Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 00:45:55 PDT 2023


pcwang-thead added a comment.

In D146191#4201151 <https://reviews.llvm.org/D146191#4201151>, @jrtc27 wrote:

> Is there a reason we can't instead add the right live-outs?

I tried, but it seems to be hard.
We call these outlined functions as `function`, but they are just shared code fragments with only one basic block. There are some differences between normal functions and outlined functions:

1. For outlined functions, they end with a JALR instruction (in which `isReturn` is false); while for normal functions, they end with a `PseudoRET` (in which `isReturn` is true). So the only basic block in outlined function is not `ReturnBlock`(See MachineBasicBlock::isReturnBlock()).
2. For normal functions, the live-outs of `ReturnBlock` are callee-saved registers and return value(s)? (IIUC, correct me if I am wrong). But all defs in outlined functions should be live.

I digged into `LivePhysRegs.cpp` and I could't find a way to add live-outs manually.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146191



More information about the llvm-commits mailing list