[Mlir-commits] [mlir] [MLIR][LLVM] Add fast-math related function attribute support (PR #79812)
Alex Bradbury
llvmlistbot at llvm.org
Mon Jan 29 06:43:06 PST 2024
================
@@ -1428,7 +1428,12 @@ def LLVM_LLVMFuncOp : LLVM_Op<"func", [
OptionalAttr<LLVM_VScaleRangeAttr>:$vscale_range,
OptionalAttr<FramePointerKindAttr>:$frame_pointer,
OptionalAttr<StrAttr>:$target_cpu,
- OptionalAttr<LLVM_TargetFeaturesAttr>:$target_features
+ OptionalAttr<LLVM_TargetFeaturesAttr>:$target_features,
+ OptionalAttr<BoolAttr>:$unsafe_fp_math,
+ OptionalAttr<BoolAttr>:$no_infs_fp_math,
+ OptionalAttr<BoolAttr>:$no_nans_fp_math,
+ OptionalAttr<BoolAttr>:$approx_func_fp_math,
+ OptionalAttr<BoolAttr>:$no_signed_zeros_fp_math
----------------
asb wrote:
That's a great question. As you say, documentation is unfortunately very sparse. I decided that closely matching the representation of the LLVM IR attribute may be less confusing and less prone to error, but I could be wrong.
It looks like the case you'd want to have an explicit false is for interaction with the `-enable-unsafe-fp-math` flag. `llvm/test/CodeGen/X86/change-unsafe-fp-math.ll` appears to test this interaction, where the `"unsafe-fp-math="false"` attribute does indeed override the codegen flag. So my conclusion is that BoolAttr is probably needed.
https://github.com/llvm/llvm-project/pull/79812
More information about the Mlir-commits
mailing list