[llvm] [DAG] Add SelectionDAG::getShiftAmountConstant APInt variant (PR #81484)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 20:27:06 PST 2024


================
@@ -2824,25 +2824,26 @@ void DAGTypeLegalizer::ExpandShiftByConstant(SDNode *N, const APInt &Amt,
   EVT NVT = InL.getValueType();
   unsigned VTBits = N->getValueType(0).getSizeInBits();
   unsigned NVTBits = NVT.getSizeInBits();
-  EVT ShTy = N->getOperand(1).getValueType();
 
   if (N->getOpcode() == ISD::SHL) {
     if (Amt.uge(VTBits)) {
       Lo = Hi = DAG.getConstant(0, DL, NVT);
     } else if (Amt.ugt(NVTBits)) {
       Lo = DAG.getConstant(0, DL, NVT);
-      Hi = DAG.getNode(ISD::SHL, DL,
-                       NVT, InL, DAG.getConstant(Amt - NVTBits, DL, ShTy));
----------------
topperc wrote:

The new shifts have a different result type so it seems reasonable to me to update the types of the shift amount to match what the target wants.

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


More information about the llvm-commits mailing list