[llvm] [X86][SelectionDAG] - Add support for llvm.canonicalize intrinsic (PR #106370)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 20:21:30 PDT 2024


================
@@ -1275,6 +1275,56 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) {
       }
     }
     break;
+    case ISD::FCANONICALIZE: {
+      const Triple &TT = DAG.getTarget().getTargetTriple();
+      if (TT.getArch() == Triple::x86 || TT.getArch() == Triple::x86_64) {
----------------
phoebewang wrote:

Either 1) or 3) looks good to me, though I'd choose 1) if I do it.

2) is a general target independent method. The crash is probably due to you didn't handle input chain. As @andykaylor pointed, many targets have already supported canonicalize. There's no much value to do it in this way.

https://github.com/llvm/llvm-project/pull/106370


More information about the llvm-commits mailing list