llvm-project
d3acd55d - [DAG] Avoid strictfp nodes in lowering of llvm.fcanonicalize

Commit
64 days ago
[DAG] Avoid strictfp nodes in lowering of llvm.fcanonicalize The default lowering of llvm.fcanonicalize, implemented in #106370 and #142105, follows the suggestions in https://llvm.org/docs/LangRef.html#llvm-canonicalize-intrinsic and implements canonicalization as a multiplication by 1.0. The problem with this implementation is that the compiler tries to "optimize" the multiplication by removing it. To prevent from this, the existing implementation uses STRICT_FMUL for the multiplication, even in the default mode. This solution has some drawbacks. First, STRICT_* nodes are designed to represent the side effects of floating-point operations. In the default Mode, these side effects are ignored for all operation, so the occurrence of strict node in this context is a misuse, it impedes the development of strictfp support. Second, the solution relies on the absence of optimizations for STRICT_FMUL. However, STRICT_* nodes should also be optimized, and future development may invalidate this assumption. This patch modifies the default expansion of llvm.fcanonicalize. Instead of using STRICT_FMUL it represents the multiplication by a special node, which is changed to FMUL immediately before the instruction selection.
Author
Committer
Parents
Loading