[llvm] [RISCV] Implement tail call optimization in machine outliner (PR #115297)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 08:10:16 PST 2024


================
@@ -2937,19 +2938,47 @@ bool RISCVInstrInfo::shouldOutlineFromFunctionByDefault(
   return MF.getFunction().hasMinSize();
 }
 
+static bool IsCandidatePatchable(const MachineInstr &MI) {
+  const MachineBasicBlock *MBB = MI.getParent();
+  const MachineFunction *MF = MBB->getParent();
+  const Function &F = MF->getFunction();
+  return F.getFnAttribute("fentry-call").getValueAsBool() ||
+         F.hasFnAttribute("patchable-function-entry");
+}
+
+static bool CannotInsertTailCall(const MachineInstr &MI) {
+  if (MI.isTerminator())
+    return IsCandidatePatchable(MI);
+  return true;
+}
+
+static bool MIUseX5(const MachineInstr &MI, const TargetRegisterInfo *TRI) {
----------------
topperc wrote:

Use -> Uses

https://github.com/llvm/llvm-project/pull/115297


More information about the llvm-commits mailing list