Skip to content

Commit

Permalink
properly handle the case when LLVM does not have min/maxnum
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Mar 22, 2018
1 parent 88268d7 commit 0118a65
Showing 1 changed file with 6 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 @@ -914,15 +914,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
self.count_insn("minnum");
unsafe {
let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs);
bug!("LLVMRustBuildMinNum is not available in LLVM version < 6.0");
if instr.is_null() {
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 {
let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs);
bug!("LLVMRustBuildMaxNum is not available in LLVM version < 6.0");
if instr.is_null() {
bug!("LLVMRustBuildMaxNum is not available in LLVM version < 6.0");
}
instr
}
}
Expand Down

0 comments on commit 0118a65

Please sign in to comment.