Skip to content

Commit e22d6d5

Browse files
committed
Fix LLVMRustSetHasUnsafeAlgebra to only have effect on instructions
1 parent 2dbac1f commit e22d6d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rustllvm/RustWrapper.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@ extern "C" void LLVMRemoveFunctionAttrString(LLVMValueRef fn, unsigned index, co
165165
}
166166

167167
// enable fpmath flag UnsafeAlgebra
168-
extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef Instr) {
169-
unwrap<Instruction>(Instr)->setHasUnsafeAlgebra(true);
168+
extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) {
169+
if (auto I = dyn_cast<Instruction>(unwrap<Value>(V))) {
170+
I->setHasUnsafeAlgebra(true);
171+
}
170172
}
171173

172174
extern "C" LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef B,

0 commit comments

Comments
 (0)