From 1841f40d2164c56dc286cef7a2e0d1bf091837f7 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Thu, 22 Mar 2018 16:28:11 +0100 Subject: [PATCH] properly handle the case when LLVM does not have min/maxnum --- src/librustc_trans/builder.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librustc_trans/builder.rs b/src/librustc_trans/builder.rs index 241ee8a48283..db803ca8209d 100644 --- a/src/librustc_trans/builder.rs +++ b/src/librustc_trans/builder.rs @@ -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 } }