[all-commits] [llvm/llvm-project] 850698: [Analysis] Ensure use of strict fp exceptions in C...

Lucas Duarte Prates via All-commits all-commits at lists.llvm.org
Mon Apr 28 02:02:15 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8506980d30fd2faf41518f24e985f820609a7bd0
      https://github.com/llvm/llvm-project/commit/8506980d30fd2faf41518f24e985f820609a7bd0
  Author: Lucas Duarte Prates <lucas.prates at arm.com>
  Date:   2025-04-28 (Mon, 28 Apr 2025)

  Changed paths:
    M llvm/lib/Analysis/CMakeLists.txt

  Log Message:
  -----------
  [Analysis] Ensure use of strict fp exceptions in ConstantFolding (#136139)

To perform constant folding in math operations, the implementation of
the ConstantFolding Analysis relies on the use of the math functions
from the host's libm. In particular, it relies on checking the value of
errno and IEEE exceptions to determine when an operation is safe to be
constant-folded.

On some platforms, such as BSD or Darwin, math library functions don't
set errno, so the ConstantFolding check depends only on the value of
IEEE exceptions. As the FP exception behaviour is set to `ignore` by
default, the compiler can perform optimisations that would get in the
way of such checks being performed correctly.

This patch sets the FP exception behaviour to `strict` when compiling
the `ConstantFolding.cpp` source file, ensuring the value of IEEE
exceptions can be reliably used by its implementation.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list