properly handle the case when LLVM does not have min/maxnum

This commit is contained in:
gnzlbg 2018-03-22 16:28:11 +01:00
parent 066c2ec9ba
commit 1841f40d21

View file

@ -921,7 +921,9 @@ 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
}
}
@ -929,7 +931,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
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
}
}