Skip to content

Commit 88f8f52

Browse files
committed
rustc_trans: 'assume' intrinsic is only available on LLVM >= 3.6
Signed-off-by: Luca Bruno <[email protected]>
1 parent 9f1c621 commit 88f8f52

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/librustc_trans/trans/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@ fn declare_intrinsic(ccx: &CrateContext, key: & &'static str) -> Option<ValueRef
873873
ifn!("llvm.lifetime.end", fn(t_i64, i8p) -> void);
874874

875875
ifn!("llvm.expect.i1", fn(i1, i1) -> i1);
876-
ifn!("llvm.assume", fn(i1) -> void);
877876

878877
// Some intrinsics were introduced in later versions of LLVM, but they have
879878
// fallbacks in libc or libm and such.
@@ -896,6 +895,7 @@ fn declare_intrinsic(ccx: &CrateContext, key: & &'static str) -> Option<ValueRef
896895
compatible_ifn!("llvm.copysign.f64", copysign(t_f64, t_f64) -> t_f64, 4);
897896
compatible_ifn!("llvm.round.f32", roundf(t_f32) -> t_f32, 4);
898897
compatible_ifn!("llvm.round.f64", round(t_f64) -> t_f64, 4);
898+
compatible_ifn!("llvm.assume", llvmcompat_assume(i1) -> void, 6);
899899

900900

901901
if ccx.sess().opts.debuginfo != NoDebugInfo {

src/rt/rust_builtin.c

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <string.h>
1414
#include <assert.h>
1515
#include <stdlib.h>
16+
#include <stdbool.h>
1617

1718
#if !defined(__WIN32__)
1819
#include <sys/time.h>
@@ -199,6 +200,11 @@ rust_unset_sigprocmask() {
199200
int *__dfly_error(void) { return __error(); }
200201
#endif
201202

203+
void
204+
llvmcompat_assume(bool c) {
205+
// empty stub for LLVM before 3.6
206+
}
207+
202208
//
203209
// Local Variables:
204210
// mode: C++

0 commit comments

Comments
 (0)