[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
Tue Jan 30 10:28:57 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:

My main concern is that people may change the naming of the MLIR attributes in LLVM dialect, and do not run any Flang testing (I think it is a usual practice to limit the testing to the components that your changes affect).  Flang LIT testing will break after the commit, while it is preferable not to have the breakage in the first place.  So I would prefer any solution that breaks the names dependency between Flang and LLVM dialect. Using the getters from LLVMFuncOp sounds acceptable. Moving this pass after the `FIRToLLVMLowering` pass seems to be an option as well.

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


More information about the flang-commits mailing list