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

Tobias Gysi via flang-commits flang-commits at lists.llvm.org
Mon Jan 29 22:44:53 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));
----------------
gysit wrote:

Adding a function to get the attribute name from LLVMDialect.td is also not completely save since the attribute name on LLVMFuncOp is generated based on the ODS operation definition. That means things could still get out of sync.

Could it potentially make sense to run this pass after lowering to LLVMFuncOp? It would have setters for the attributes. Alternatively, LLVMFuncOp has getters to obtain the attribute names.



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


More information about the flang-commits mailing list