[PATCH] D91331: Add hook for target to customize different legalization action according to the input type

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 21:25:07 PST 2020

craig.topper added inline comments.

Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:4335
+    // If the input is not legal, eg: i1 -> fp, then it needs to be promoted to
+    // a larger type, eg: i8 -> fp.  Even if it is legal, no libcall may exactly
The input type should be legal here so I don't think this comment makes sense as is.

Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:4447
+    // We can only expand it into libcall if the TRUNC is 0.
+    const ConstantSDNode *TRUNC = dyn_cast<ConstantSDNode>(Node->getOperand(1));
+    assert(TRUNC && TRUNC->isNullValue() &&
The result of a dyn_cast shouldn't be checked for null by an assert. That should just be a cast. Is it dyn_cast in the type legalizer too?

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list