[llvm] [LangRef] Clarify the semantics of fast-math flags (PR #89442)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 13:09:51 PDT 2024


================
@@ -3656,6 +3656,45 @@ floating-point transformations.
 ``fast``
    This flag implies all of the others.
 
+When performing a transformation that involves more that one instruction, the
+flags required to enable the transformation must be set on all instructions
+involved in the transformation, and any new instructions created by the
+transformation should have only those flags set which were set on all the
+original instructions that are being transformed.
----------------
jcranmer-intel wrote:

I've been putting together an RFC on FMF semantics, but one of the things I note is that there's a definite dichotomy between `nnan`/`ninf`/`nsz` (which have clear value-based semantics) and `reassoc`/`afn`/`arcp`/`contract` (which probably have to be rewrite-based semantics). For the rewrite-based semantics flags, it's necessary that the flags be present on all operations in the expression.

I don't have great wording to suggest at the moment (not unless you want a page of text), but maybe it would be better to delineate the flags for which the all-instructions-must-have-the-flags-to-be-rewritten property is true?

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


More information about the llvm-commits mailing list