Skip to content

Commit 0118a65

Browse files
committed
properly handle the case when LLVM does not have min/maxnum
1 parent 88268d7 commit 0118a65

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustc_trans/builder.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -914,15 +914,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
914914
self.count_insn("minnum");
915915
unsafe {
916916
let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs);
917-
bug!("LLVMRustBuildMinNum is not available in LLVM version < 6.0");
917+
if instr.is_null() {
918+
bug!("LLVMRustBuildMinNum is not available in LLVM version < 6.0");
919+
}
918920
instr
919921
}
920922
}
921923
pub fn maxnum(&self, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
922924
self.count_insn("maxnum");
923925
unsafe {
924926
let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs);
925-
bug!("LLVMRustBuildMaxNum is not available in LLVM version < 6.0");
927+
if instr.is_null() {
928+
bug!("LLVMRustBuildMaxNum is not available in LLVM version < 6.0");
929+
}
926930
instr
927931
}
928932
}

0 commit comments

Comments
 (0)