[llvm] [DAG] Introduce generic shl_add node [NFC] (PR #88791)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 10:18:39 PDT 2024


================
@@ -12789,10 +12789,9 @@ static SDValue transformAddShlImm(SDNode *N, SelectionDAG &DAG,
   SDLoc DL(N);
   SDValue NS = (C0 < C1) ? N0->getOperand(0) : N1->getOperand(0);
   SDValue NL = (C0 > C1) ? N0->getOperand(0) : N1->getOperand(0);
-  SDValue NA0 =
-      DAG.getNode(ISD::SHL, DL, VT, NL, DAG.getConstant(Diff, DL, VT));
-  SDValue NA1 = DAG.getNode(ISD::ADD, DL, VT, NA0, NS);
-  return DAG.getNode(ISD::SHL, DL, VT, NA1, DAG.getConstant(Bits, DL, VT));
+  SDValue SHADD =
+      DAG.getNode(ISD::SHL_ADD, DL, VT, NL, DAG.getConstant(Diff, DL, VT), NS);
----------------
topperc wrote:

Should we use TargetConstant if its required to be a constant?

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


More information about the llvm-commits mailing list