[llvm] `__builtin.canonicalize` in common code (PR #142105)
Dominik Steenken via llvm-commits
llvm-commits at lists.llvm.org
Fri May 30 02:28:51 PDT 2025
================
@@ -3356,6 +3356,23 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
Results.push_back(Op);
break;
}
+ case ISD::FCANONICALIZE: {
+ // This implements llvm.canonicalize.f* by multiplication with 1.0,
+ // as suggested in https://llvm.org/docs/LangRef.html#id2335.
----------------
dominik-steenken wrote:
>From what i understand, the point of the strictfp operation here is to prevent any optimization that would, for instance, recognize that `1.0 * x` can be converted to just `x`. So would this suffice as an addition to the comment?
```
// We use `STRICT_FMUL` here to prevent this operation from being optimized out.
```
https://github.com/llvm/llvm-project/pull/142105
More information about the llvm-commits
mailing list