[all-commits] [llvm/llvm-project] bbf0d1: Currently the control of the eval-method is mixed ...

Zahira Ammarguellat via All-commits all-commits at lists.llvm.org
Thu Mar 17 11:48:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bbf0d1932a3c1be970ed8a580e51edf571b80fd5
      https://github.com/llvm/llvm-project/commit/bbf0d1932a3c1be970ed8a580e51edf571b80fd5
  Author: Zahira Ammarguellat <zahira.ammarguellat at intel.com>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M clang/include/clang/Lex/Preprocessor.h
    M clang/lib/Lex/PPMacroExpansion.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaAttr.cpp
    A clang/test/CodeGen/eval-method-fast-math.cpp

  Log Message:
  -----------
  Currently the control of the eval-method is mixed with fast-math.
FLT_EVAL_METHOD tells the user the precision at which, temporary results
are evaluated but when fast-math is enabled, the numeric values are not
guaranteed to match the source semantics, so the eval-method is
meaningless.
For example, the expression `x + y + z` has as source semantics `(x + y)
+ z`. FLT_EVAL_METHOD is telling the user at which precision `(x + y)`
is evaluated. With fast-math enable the compiler can choose to
evaluate the expression as `(y + z) + x`.
The correct behavior is to set the FLT_EVAL_METHOD to `-1` to tell the
user that the precision of the intermediate values is unknow. This
patch is doing that.

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




More information about the All-commits mailing list