[PATCH] D123630: Remove connection between 'ffast-math' and 'ffp-contract'.

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 13:39:58 PDT 2022


zahiraam created this revision.
zahiraam added reviewers: aaron.ballman, andrew.w.kaylor, rjmccall, joerg, efriedma.
Herald added a project: All.
zahiraam requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: clang.

Currently the options ‘ffast-math’ and the option ‘ffp-contract’ are connect. When ‘ffast-math’ is set, ffp-contract is altered this way:

-ffast-math/ Ofast -> ffp-contract=fast
-fno-fast-math     -> if ffp-contract= fast then ffp-contract=on else ffp-contract unchanged

This differs from gcc which doesn’t connect the two options, and triggered some spurious warnings; see issue https://github.com/llvm/llvm-project/issues/54625.

The source of the problem is that the ‘ffast-math’ option is an on/off flag, but the ‘ffp-contract’ is an on/off/fast flag. So when ‘fno-fast-math’ is used there is no 
obvious value for ‘ffp-contract’.

This patch is proposing a change to make the two options unrelated.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123630

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/ffp-contract-option.c
  clang/test/CodeGen/ffp-model.c
  clang/test/Driver/clang_f_opts.c
  clang/test/Driver/fast-math.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123630.422323.patch
Type: text/x-patch
Size: 5200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220412/75c843af/attachment.bin>


More information about the cfe-commits mailing list