Skip to content

Commit 03e0aa5

Browse files
committed
Set only fast-math flags which don't produce poison
1 parent 11f32b7 commit 03e0aa5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -420,12 +420,15 @@ extern "C" LLVMAttributeRef LLVMRustCreateMemoryEffectsAttr(LLVMContextRef C,
420420
}
421421
}
422422

423-
// Enable a fast-math flag
423+
// Enable fast-math flags which do not let operations return poison.
424424
//
425425
// https://llvm.org/docs/LangRef.html#fast-math-flags
426426
extern "C" void LLVMRustSetFastMath(LLVMValueRef V) {
427427
if (auto I = dyn_cast<Instruction>(unwrap<Value>(V))) {
428-
I->setFast(true);
428+
I->setHasAllowReassoc(true);
429+
I->setHasAllowContract(true);
430+
I->setHasAllowReciprocal(true);
431+
I->setHasNoSignedZeros(true);
429432
}
430433
}
431434

0 commit comments

Comments
 (0)