[flang-commits] [flang] [mlir] [RFC][mlir] Conditional support for fast-math attributes. (PR #125620)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Tue Feb 4 15:01:02 PST 2025


vzakhari wrote:

> Sorry, I was mostly thinking out loud and did not mean to derail this PR. I'm trying to understand the goal stated in the PR description:
> 
> > This is inspired by https://llvm.org/docs/LangRef.html#fastmath-return-types and my goal to add fast-math support for arith.select operation that may produce results of any type.

Thanks for the explanation!

> I'd think that the real implementation can have a matcher that checks if `arith.select` operands are `<insert-your-favorite-fmf-assumption>`, and frontends can insert these `assumef` ops to communicate this in the absence of anything else that would imply it.

I am not against the `assume` operations, but what I am trying to say is that MLIR region simplification may turn the operands of `arith.select` into block arguments, and so the matching will not be as easy as looking at the operands, it will be more as looking at all the possible values of the argument blocks and merging the fast-math flags meaning across all these values.  At the same time, some attribution of the block arguments with fast-math may be needed, anyway, if we decide to follow LLVM's approach and mark the PHIs with fast-math.

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


More information about the flang-commits mailing list