Skip to content

Commit 448e254

Browse files
committed
All intrinsics are available in all supported LLVM versions
1 parent 3f36f7a commit 448e254

File tree

1 file changed

+1
-39
lines changed

1 file changed

+1
-39
lines changed

Diff for: src/librustc_trans/context.rs

+1-39
Original file line numberDiff line numberDiff line change
@@ -1097,45 +1097,7 @@ fn declare_intrinsic(ccx: &CrateContext, key: &str) -> Option<ValueRef> {
10971097
ifn!("llvm.localrecover", fn(i8p, i8p, t_i32) -> i8p);
10981098
ifn!("llvm.x86.seh.recoverfp", fn(i8p, i8p) -> i8p);
10991099

1100-
// Some intrinsics were introduced in later versions of LLVM, but they have
1101-
// fallbacks in libc or libm and such.
1102-
macro_rules! compatible_ifn {
1103-
($name:expr, noop($cname:ident ($($arg:expr),*) -> void), $llvm_version:expr) => (
1104-
if unsafe { llvm::LLVMVersionMinor() >= $llvm_version } {
1105-
// The `if key == $name` is already in ifn!
1106-
ifn!($name, fn($($arg),*) -> void);
1107-
} else if key == $name {
1108-
let f = declare::declare_cfn(ccx, stringify!($cname),
1109-
Type::func(&[$($arg),*], &void));
1110-
llvm::SetLinkage(f, llvm::InternalLinkage);
1111-
1112-
let bld = ccx.builder();
1113-
let llbb = unsafe {
1114-
llvm::LLVMAppendBasicBlockInContext(ccx.llcx(), f,
1115-
"entry-block\0".as_ptr() as *const _)
1116-
};
1117-
1118-
bld.position_at_end(llbb);
1119-
bld.ret_void();
1120-
1121-
ccx.intrinsics().borrow_mut().insert($name, f.clone());
1122-
return Some(f);
1123-
}
1124-
);
1125-
($name:expr, $cname:ident ($($arg:expr),*) -> $ret:expr, $llvm_version:expr) => (
1126-
if unsafe { llvm::LLVMVersionMinor() >= $llvm_version } {
1127-
// The `if key == $name` is already in ifn!
1128-
ifn!($name, fn($($arg),*) -> $ret);
1129-
} else if key == $name {
1130-
let f = declare::declare_cfn(ccx, stringify!($cname),
1131-
Type::func(&[$($arg),*], &$ret));
1132-
ccx.intrinsics().borrow_mut().insert($name, f.clone());
1133-
return Some(f);
1134-
}
1135-
)
1136-
}
1137-
1138-
compatible_ifn!("llvm.assume", noop(llvmcompat_assume(i1) -> void), 6);
1100+
ifn!("llvm.assume", fn(i1) -> void);
11391101

11401102
if ccx.sess().opts.debuginfo != NoDebugInfo {
11411103
ifn!("llvm.dbg.declare", fn(Type::metadata(ccx), Type::metadata(ccx)) -> void);

0 commit comments

Comments
 (0)