Skip to content

Commit

Permalink
require llvm 6
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Mar 22, 2018
1 parent ecafa7b commit 88268d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/librustc_trans/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,13 +913,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
pub fn minnum(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
self.count_insn("minnum");
unsafe {
llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs)
let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs);
bug!("LLVMRustBuildMinNum is not available in LLVM version < 6.0");
instr
}
}
pub fn maxnum(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
self.count_insn("maxnum");
unsafe {
llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs)
let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs);
bug!("LLVMRustBuildMaxNum is not available in LLVM version < 6.0");
instr
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,7 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef, LLVMValueRef, bool) {
}
#endif

#if LLVM_VERSION_GE(6, 0)
extern "C" LLVMValueRef
LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) {
return wrap(unwrap(B)->CreateMinNum(unwrap(LHS),unwrap(RHS)));
Expand All @@ -1501,3 +1502,13 @@ extern "C" LLVMValueRef
LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) {
return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS),unwrap(RHS)));
}
#else
extern "C" LLVMValueRef
LLVMRustBuildMinNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
return nullptr;
}
extern "C" LLVMValueRef
LLVMRustBuildMaxNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
return nullptr;
}
#endif

0 comments on commit 88268d7

Please sign in to comment.