summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index f488a517b23..33174c1e9df 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -165,8 +165,10 @@ extern "C" void LLVMRemoveFunctionAttrString(LLVMValueRef fn, unsigned index, co
 }
 
 // enable fpmath flag UnsafeAlgebra
-extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef Instr) {
-    unwrap<Instruction>(Instr)->setHasUnsafeAlgebra(true);
+extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) {
+    if (auto I = dyn_cast<Instruction>(unwrap<Value>(V))) {
+        I->setHasUnsafeAlgebra(true);
+    }
 }
 
 extern "C" LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef B,