Skip to content

Commit c64c6d8

Browse files
committed
Use LLVMSetTailCallKind
1 parent 3507a74 commit c64c6d8

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
14531453
instance: Option<Instance<'tcx>>,
14541454
) {
14551455
let call = self.call(llty, fn_attrs, Some(fn_abi), llfn, args, funclet, instance);
1456-
llvm::LLVMRustSetTailCallKind(call, llvm::TailCallKind::MustTail);
1456+
llvm::LLVMSetTailCallKind(call, llvm::TailCallKind::MustTail);
14571457

14581458
match &fn_abi.ret.mode {
14591459
PassMode::Ignore | PassMode::Indirect { .. } => self.ret_void(),

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub(crate) enum ModuleFlagMergeBehavior {
9797

9898
// Consts for the LLVM CallConv type, pre-cast to usize.
9999

100+
/// Must match the layout of `LLVMTailCallKind`.
100101
#[derive(Copy, Clone, PartialEq, Debug)]
101102
#[repr(C)]
102103
#[allow(dead_code)]
@@ -1197,7 +1198,7 @@ unsafe extern "C" {
11971198
pub(crate) safe fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
11981199
pub(crate) safe fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
11991200
pub(crate) safe fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1200-
pub(crate) safe fn LLVMRustSetTailCallKind(CallInst: &Value, Kind: TailCallKind);
1201+
pub(crate) safe fn LLVMSetTailCallKind(CallInst: &Value, kind: TailCallKind);
12011202

12021203
// Operations on attributes
12031204
pub(crate) fn LLVMCreateStringAttribute(

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,29 +1993,3 @@ extern "C" void LLVMRustSetNoSanitizeHWAddress(LLVMValueRef Global) {
19931993
MD.NoHWAddress = true;
19941994
GV.setSanitizerMetadata(MD);
19951995
}
1996-
1997-
enum class LLVMRustTailCallKind {
1998-
None = 0,
1999-
Tail = 1,
2000-
MustTail = 2,
2001-
NoTail = 3
2002-
};
2003-
2004-
extern "C" void LLVMRustSetTailCallKind(LLVMValueRef Call,
2005-
LLVMRustTailCallKind Kind) {
2006-
CallInst *CI = unwrap<CallInst>(Call);
2007-
switch (Kind) {
2008-
case LLVMRustTailCallKind::None:
2009-
CI->setTailCallKind(CallInst::TCK_None);
2010-
break;
2011-
case LLVMRustTailCallKind::Tail:
2012-
CI->setTailCallKind(CallInst::TCK_Tail);
2013-
break;
2014-
case LLVMRustTailCallKind::MustTail:
2015-
CI->setTailCallKind(CallInst::TCK_MustTail);
2016-
break;
2017-
case LLVMRustTailCallKind::NoTail:
2018-
CI->setTailCallKind(CallInst::TCK_NoTail);
2019-
break;
2020-
}
2021-
}

0 commit comments

Comments
 (0)