[llvm] [CodeGen] Provide `MachineFunction::hasUnsafeFPMath` (PR #127488)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 20:38:59 PST 2025


================
@@ -699,6 +699,11 @@ bool MachineFunction::needsFrameMoves() const {
          !F.getParent()->debug_compile_units().empty();
 }
 
+/// True if function attribute unsafe-fp-math is true.
+bool MachineFunction::hasUnsafeFPMath() const {
+  return F.getFnAttribute("unsafe-fp-math").getValueAsBool();
----------------
paperchalice wrote:

Change it to a member variable is ok. Currently `resetTargetOptions` has higher priority than `--enable-unsafe-fp-math`, this results in some unreliable codes in backends and tests, change it to `Options.UnsafeFPMath || F.getFnAttribute("unsafe-fp-math").getValueAsBool()` break some tests.

https://github.com/llvm/llvm-project/pull/127488


More information about the llvm-commits mailing list