[PATCH] D114357: [CodeGen] Change getAnyExtOrTrunc to use SIGN_EXTEND for some constants

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 24 08:47:24 PST 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1315
 SDValue SelectionDAG::getAnyExtOrTrunc(SDValue Op, const SDLoc &DL, EVT VT) {
-  return VT.bitsGT(Op.getValueType()) ?
-    getNode(ISD::ANY_EXTEND, DL, VT, Op) :
-    getNode(ISD::TRUNCATE, DL, VT, Op);
+  if (VT.bitsGT(Op.getValueType())) {
+    ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
----------------
There's no guarantee that the caller would use getAnyExtOrTrunc. I think this should be in the constant folding for getNode(ISD::ANY_EXTEND)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114357/new/

https://reviews.llvm.org/D114357



More information about the llvm-commits mailing list