[flang-commits] [flang] [flang][OpenMP] Use maxnum/minnum for lowering of max/min reduction operators (PR #89258)

Jan Leyonberg via flang-commits flang-commits at lists.llvm.org
Thu Apr 18 10:21:48 PDT 2024


jsjodin wrote:

> I have a concern with making a change this early in the compilation process only to avoid a selection error in the backend. First of all, we seem to replace an IEEE-compliant operation with one that isn't. Such a replacement should only be done if the compiler is allowed to do that (via relevant FP flags). Second, this is a legal operation in MLIR, and presumably in LLVM IR. If the backend can't generate valid code for it, then it's a missing functionality in the backend. Lastly, the replacing of an IEEE-compliant operation with a similar one should be done by the backend, since it's the backend that knows (1) if the operation needs to be replaced, and (2) what to replace it with.

I think this change is probably okay since OpenMP 5.0 with min/max reductions was released 2018 and the IEEE-compliance relates to a 2019 draft. So we're not changing the semantics of OpenMP in this case.

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


More information about the flang-commits mailing list