about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorUlrik Sverdrup <bluss@users.noreply.github.com>2016-03-19 22:02:33 +0100
committerUlrik Sverdrup <bluss@users.noreply.github.com>2016-03-19 22:35:28 +0100
commite22d6d569fcbcf960261d71f67d554a7859fdfeb (patch)
tree45b4911e756311e066cd9d45ccfc9700b7e58470 /src/rustllvm/RustWrapper.cpp
parent2dbac1fb8ed43cbcd160855803d50a51c38b8cee (diff)
downloadrust-e22d6d569fcbcf960261d71f67d554a7859fdfeb.tar.gz
rust-e22d6d569fcbcf960261d71f67d554a7859fdfeb.zip
Fix LLVMRustSetHasUnsafeAlgebra to only have effect on instructions
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,