[all-commits] [llvm/llvm-project] 91628f: The handling of 'funsafe-math-optimizations' doesn...

Zahira Ammarguellat via All-commits all-commits at lists.llvm.org
Fri Nov 11 07:24:29 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 91628f0616ca5203945afb56b3d8a27522b99808
      https://github.com/llvm/llvm-project/commit/91628f0616ca5203945afb56b3d8a27522b99808
  Author: Zahira Ammarguellat <zahira.ammarguellat at intel.com>
  Date:   2022-11-11 (Fri, 11 Nov 2022)

  Changed paths:
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/test/CodeGenOpenCL/relaxed-fpmath.cl
    M clang/test/Driver/fp-contract.c

  Log Message:
  -----------
  The handling of 'funsafe-math-optimizations' doesn't update the 'MathErrno'
flag. But the driver checks for 'fno-math-errno' before passing
'funsafe-math-optimizations' to the FE. In GCC, the option
'funsafe-math-optimizations' doesn't affect the 'fmath-errno' flag.
This patch aligns clang with GCC.

'-ffast-math' sets the FPContract to 'fast'. But 'funsafe-math-optimizations'
the driver doesn't consider the FPContract when handling the option.
Unfortunately there are places in the BE that interpret unsafe math
mode as allowing FMA. This patch makes -ffast-math' and
'funsafe-math-optimizations' behave similarly in regard to the setting of the
FPContract.

Differential Revision: https://reviews.llvm.org/D137578




More information about the All-commits mailing list