aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/TestModuleFileExtension.cpp
diff options
context:
space:
mode:
authorLewis Crawford <lcrawford@nvidia.com>2025-05-30 11:27:18 +0100
committerGitHub <noreply@github.com>2025-05-30 11:27:18 +0100
commit1f7885cf9c6801d11491c8c194c999f7223dd141 (patch)
tree8749196f5987f3c787d26a1fe398301ef010acdc /clang/lib/Frontend/TestModuleFileExtension.cpp
parent7c996012ceee0997838e3246cce169652b0b6eb6 (diff)
downloadllvm-1f7885cf9c6801d11491c8c194c999f7223dd141.zip
llvm-1f7885cf9c6801d11491c8c194c999f7223dd141.tar.gz
llvm-1f7885cf9c6801d11491c8c194c999f7223dd141.tar.bz2
[ConstantFolding] Add flag to disable call folding (#140270)
Add an optional flag to disable constant-folding for function calls. This applies to both intrinsics and libcalls. This is not necessary in most cases, so is disabled by default, but in cases that require bit-exact precision between the result from constant-folding and run-time execution, having this flag can be useful, and may help with debugging. Cases where mismatches can occur include GPU execution vs host-side folding, cross-compilation scenarios, or compilation vs execution environments with different math library versions. This applies only to calls, rather than all FP arithmetic. Methods such as fast-math-flags can be used to limit reassociation, fma-fusion etc, and basic arithmetic operations are precisely defined in IEEE 754. However, other math operations such as sqrt, sin, pow etc. represented by either libcalls or intrinsics are less well defined, and may vary more between different architectures/library implementations. As this option is not intended for most common use-cases, this patch takes the more conservative approach of disabling constant-folding even for operations like fmax, copysign, fabs etc. in order to keep the implementation simple, rather than sprinkling checks for this flag throughout. The use-cases for this option are similar to StrictFP, but it is only limited to FP call folding, rather than all FP operations, as it is about precise arithmetic results, rather than FP environment behaviours. It also can be used to when linking .bc files compiled with different StrictFP settings with llvm-link.
Diffstat (limited to 'clang/lib/Frontend/TestModuleFileExtension.cpp')
0 files changed, 0 insertions, 0 deletions