]> granicus.if.org Git - clang/commit
Fix PR11685 by implementing -ffast-math and its various friends in the
authorChandler Carruth <chandlerc@gmail.com>
Mon, 2 Jan 2012 14:19:45 +0000 (14:19 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 2 Jan 2012 14:19:45 +0000 (14:19 +0000)
commitabf07a7fb669dcb74040eef948d61dfe3c59ff17
tree07bd4265036179237cb2cc51c788e48912716537
parent1e8a0678df724a28fe47e0034246f2604056a278
Fix PR11685 by implementing -ffast-math and its various friends in the
Clang driver. This involves a bunch of silly option parsing code to try
to carefully emulate GCC's options. Currently, this takes a conservative
approach, and unless all of the unsafe optimizations are enabled, none
of them are. The fine grained control doesn't seem particularly useful.
If it ever becomes useful, we can add that to LLVM first, and then
expose it here.

This also fixes a few tiny bugs in the flag management around
-fhonor-infinities and -fhonor-nans; the flags now form proper sets both
for enabling and disabling, with the last flag winning.

I've also implemented a moderately terrifying GCC feature where
a language change is also provided by the '-ffast-math' flag by defining
the __FAST_MATH__ preprocessor macro. This feature is tracked and
serialized in the frontend but it isn't used yet. A subsequent patch
will add the preprocessor macro and tests for it.

I've manually tested that codegen appears to respect this, but I've not
dug in enough to see if there is an easy way to test codegen options w/o
relying on the particulars of LLVM's optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147434 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/LangOptions.def
include/clang/Driver/ArgList.h
include/clang/Driver/CC1Options.td
include/clang/Driver/Options.td
lib/Driver/ArgList.cpp
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp
test/Driver/fast-math.c [new file with mode: 0644]