about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgnzlbg <gonzalobg88@gmail.com>2018-03-22 16:28:11 +0100
committergnzlbg <gonzalobg88@gmail.com>2018-03-26 10:20:41 +0200
commit1841f40d2164c56dc286cef7a2e0d1bf091837f7 (patch)
tree5a0da8b6b006bc0c7951aaf25fe1c55499f4fa49
parent066c2ec9baac1be5e884e48813a542de8f5d64b0 (diff)
downloadrust-1841f40d2164c56dc286cef7a2e0d1bf091837f7.tar.gz
rust-1841f40d2164c56dc286cef7a2e0d1bf091837f7.zip
properly handle the case when LLVM does not have min/maxnum
-rw-r--r--src/librustc_trans/builder.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc_trans/builder.rs b/src/librustc_trans/builder.rs
index 241ee8a4828..db803ca8209 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
         }
     }