Skip to content

Commit 1841f40

Browse files
committed
properly handle the case when LLVM does not have min/maxnum
1 parent 066c2ec commit 1841f40

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustc_trans/builder.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,15 +921,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
921921
self.count_insn("minnum");
922922
unsafe {
923923
let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs);
924-
bug!("LLVMRustBuildMinNum is not available in LLVM version < 6.0");
924+
if instr.is_null() {
925+
bug!("LLVMRustBuildMinNum is not available in LLVM version < 6.0");
926+
}
925927
instr
926928
}
927929
}
928930
pub fn maxnum(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
929931
self.count_insn("maxnum");
930932
unsafe {
931933
let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs);
932-
bug!("LLVMRustBuildMaxNum is not available in LLVM version < 6.0");
934+
if instr.is_null() {
935+
bug!("LLVMRustBuildMaxNum is not available in LLVM version < 6.0");
936+
}
933937
instr
934938
}
935939
}

0 commit comments

Comments
 (0)