diff --git a/src/librustc_trans/builder.rs b/src/librustc_trans/builder.rs index 66ae60345c50..4615a3b17c61 100644 --- a/src/librustc_trans/builder.rs +++ b/src/librustc_trans/builder.rs @@ -914,7 +914,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 } } @@ -922,7 +924,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 } }