[PATCH] D14707: add fast-math-flags to 'call' instructions (PR21290)

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 14:15:51 PST 2015


hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.

A few minor things, and with these changes, LGTM.


================
Comment at: docs/LangRef.rst:8453
@@ -8452,3 +8452,3 @@
 
-      <result> = [tail | musttail | notail ] call [cconv] [ret attrs] <ty> [<fnty>*] <fnptrval>(<function args>) [fn attrs]
+      <result> = [tail | musttail | notail ] call [fmf] [cconv] [ret attrs] <ty> [<fnty>*] <fnptrval>(<function args>) [fn attrs]
                    [ operand bundles ]
----------------
I find this confusing; we should just use [fast-math flags]* instead of [fmf] as we do elsewhere.

================
Comment at: docs/LangRef.rst:8510
@@ -8509,1 +8509,3 @@
 
+#. The optional ``fmf`` marker indicates that the call has one or more 
+   :ref:`fast-math flags <fastmath>`, which are optimization hints to enable
----------------
Adjust for [fmf] -> [fast-math flags]*

================
Comment at: docs/LangRef.rst:8512
@@ +8511,3 @@
+   :ref:`fast-math flags <fastmath>`, which are optimization hints to enable
+   otherwise unsafe floating-point optimizations.
+
----------------
We must document here that these flags are valid only for calls with a floating-point scalar or vector return type.


================
Comment at: lib/AsmParser/LLParser.cpp:5677
@@ +5676,3 @@
+  if (FMF.any() && !RetType->isFPOrFPVectorTy())
+    return Error(CallLoc, "fast-math-flags specified for invalid call");
+
----------------
I think it would be better to say how the call was invalid (and, minus the fmfs, the call itself may be fine). How about:

  return Error(CallLoc, "fast-math-flags specified for call without floating-point scalar or vector return type");

================
Comment at: lib/Bitcode/Reader/BitcodeReader.cpp:5108
@@ +5107,3 @@
+        if (!isa<FPMathOperator>(I))
+          return error("Fast math flags set for non-floating-point call");
+        I->setFastMathFlags(FMF);
----------------
Match this error text to the text in lib/AsmParser/LLParser.cpp.


http://reviews.llvm.org/D14707





More information about the llvm-commits mailing list