[LLVMdev] Representing -ffast-math at the IR level

Duncan Sands baldrick at free.fr
Mon Apr 16 04:41:46 PDT 2012


Here's a revised patch, plus patches showing how fpmath metadata could be
turned on in clang and dragonegg (it seemed safest for the moment to
condition on -ffast-math rather than on one of the flags implied by
-ffast-math).

Major changes:

- The FPMathOperator class can no longer be used to change math settings,
only to read them.  Currently it can be queried for accuracy info.  I split
the accuracy methods into two: one for 'fast' accuracy, one for a numerical
accuracy (which returns +infty when the accuracy is 'fast').

- MDBuilder got support for creating fpmath metadata, in particular there is
function that returns the appropriate settings for -ffast-math.

- A default fpmath setting can be supplied to IRBuilder, which will then apply
it to all floating point operations.  It is also possible to specify specific
fpmath metadata when creating an operation.

Ciao, Duncan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fastm.diff
Type: text/x-patch
Size: 18788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120416/e7f4b1c8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fastm-clang.diff
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120416/e7f4b1c8/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fastm-dragonegg.diff
Type: text/x-patch
Size: 563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120416/e7f4b1c8/attachment-0002.bin>


More information about the llvm-dev mailing list