Skip to content

Commit

Permalink
Merge rust-lang#24
Browse files Browse the repository at this point in the history
24: Add a switch to disable tail call optimisations on x86_64. r=ltratt a=vext01



Co-authored-by: Edd Barrett <[email protected]>
  • Loading branch information
bors[bot] and vext01 authored Feb 24, 2022
2 parents afd1c99 + e8239fa commit 0523c33
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ static cl::opt<bool> ExperimentalUnorderedISEL(
"stores respectively."),
cl::Hidden);

static cl::opt<bool> YkDisableTailCallCodegen(
"yk-disable-tail-call-codegen", cl::init(false),
cl::desc("Do not optimise tail calls"),
cl::Hidden);

/// Call this when the user attempts to do something unsupported, like
/// returning a double without SSE2 enabled on x86_64. This is not fatal, unlike
/// report_fatal_error, so calling code should attempt to recover without
Expand Down Expand Up @@ -3918,6 +3923,16 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
bool isVarArg = CLI.IsVarArg;
const auto *CB = CLI.CB;

// Tail call optimisations interfere with the trace compiler's inlining
// stack, as we never see the return for the caller (the caller's frame is
// reused, and the callee's return returns from both the caller and the
// callee).
//
// YKFIXME: https://github.com/ykjit/yk/issues/502
// We should find a way to allow tail calls.
if (YkDisableTailCallCodegen)
isTailCall = false;

MachineFunction &MF = DAG.getMachineFunction();
bool Is64Bit = Subtarget.is64Bit();
bool IsWin64 = Subtarget.isCallingConvWin64(CallConv);
Expand Down

0 comments on commit 0523c33

Please sign in to comment.