[flang-commits] [flang] [flang] Set fast math related function attributes for -Ofast/-ffast-math (PR #79301)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Wed Jan 31 10:59:29 PST 2024


================
@@ -45,14 +50,32 @@ void FunctionAttrPass::runOnOperation() {
     func->setAttr("frame_pointer", mlir::LLVM::FramePointerKindAttr::get(
                                        context, framePointerKind));
 
+  if (noInfsFPMath)
+    func->setAttr("no_infs_fp_math", mlir::BoolAttr::get(context, true));
----------------
vzakhari wrote:

After #79812 we should get static methods in `LLVMFuncOp` class that return the required attribute names, e.g. `getUnsafeFpMathAttrName`, `getNoNansFpMathAttrName`, etc.  You may look it up in `tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.h.inc` in your llvm build location.

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


More information about the flang-commits mailing list