From 6d4ea22e70924da411998edcbdb321bfd3f17545 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 25 Sep 2019 14:35:02 +0000 Subject: [IR] allow fast-math-flags on phi of FP values (2nd try) The changes here are based on the corresponding diffs for allowing FMF on 'select': D61917 As discussed there, we want to have fast-math-flags be a property of an FP value because the alternative (having them on things like fcmp) leads to logical inconsistency such as: https://bugs.llvm.org/show_bug.cgi?id=38086 The earlier patch for select made almost no practical difference because most unoptimized conditional code begins life as a phi (based on what I see in clang). Similarly, I don't expect this patch to do much on its own either because SimplifyCFG promptly drops the flags when converting to select on a minimal example like: https://bugs.llvm.org/show_bug.cgi?id=39535 But once we have this plumbing in place, we should be able to wire up the FMF propagation and start solving cases like that. The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a regression in a LoopVectorize test. We are intersecting the FMF of any FPMathOperator there, so if a phi is not properly annotated, new math instructions may not be either. Once we fix the propagation in SimplifyCFG, it may be safe to remove that hack. Differential Revision: https://reviews.llvm.org/D67564 llvm-svn: 372878 --- llvm/docs/LangRef.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'llvm/docs/LangRef.rst') diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index 87e1b971605..a38356aa27e 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -10067,7 +10067,7 @@ Syntax: :: - = phi [ , ], ... + = phi [fast-math-flags] [ , ], ... Overview: """"""""" @@ -10094,6 +10094,12 @@ deemed to occur on the edge from the corresponding predecessor block to the current block (but after any definition of an '``invoke``' instruction's return value on the same edge). +The optional ``fast-math-flags`` marker indicates that the phi has one +or more :ref:`fast-math-flags `. These are optimization hints +to enable otherwise unsafe floating-point optimizations. Fast-math-flags +are only valid for phis that return a floating-point scalar or vector +type. + Semantics: """""""""" -- cgit v1.2.3