Skip to content

Commit 91064bf

Browse files
committed
dont enforce tails
1 parent b147997 commit 91064bf

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

compiler/rustc_codegen_llvm/src/mono_item.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_middle::mir::mono::Visibility;
1212
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv, LayoutOf};
1313
use rustc_middle::ty::{self, Instance, Ty, TypeVisitableExt};
1414
use rustc_session::config::CrateType;
15-
use rustc_target::callconv::FnAbi;
15+
use rustc_target::callconv::{FnAbi, PassMode};
1616
use rustc_target::spec::{Arch, RelocModel};
1717
use tracing::debug;
1818

@@ -187,15 +187,22 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
187187
args.push(llvm::get_param(alias_lldecl, index));
188188
}
189189

190-
start_bx.tail_call(
190+
let call = start_bx.call(
191191
fn_ty,
192192
Some(attrs),
193-
fn_abi,
193+
Some(fn_abi),
194194
aliasee,
195195
&args,
196196
None,
197197
Some(aliasee_instance),
198198
);
199+
200+
match &fn_abi.ret.mode {
201+
PassMode::Ignore | PassMode::Indirect { .. } => start_bx.ret_void(),
202+
PassMode::Direct(_) | PassMode::Pair { .. } | PassMode::Cast { .. } => {
203+
start_bx.ret(call)
204+
}
205+
}
199206
}
200207
}
201208

0 commit comments

Comments
 (0)