[TargetLowering] SimplifyDemandedBits - pull out shift value type. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 5 Jun 2019 10:59:04 +0000 (10:59 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 5 Jun 2019 10:59:04 +0000 (10:59 +0000)
Will be used more in an upcoming patch.

llvm-svn: 362595

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 785530b..6e6917b 100644 (file)
@@ -1136,6 +1136,7 @@ bool TargetLowering::SimplifyDemandedBits(
       if (SA->getAPIntValue().uge(BitWidth))
         break;
 
+      EVT ShiftVT = Op1.getValueType();
       unsigned ShAmt = SA->getZExtValue();
       APInt InDemandedMask = (DemandedBits << ShAmt);
 
@@ -1160,7 +1161,7 @@ bool TargetLowering::SimplifyDemandedBits(
                 Opc = ISD::SHL;
               }
 
-              SDValue NewSA = TLO.DAG.getConstant(Diff, dl, Op1.getValueType());
+              SDValue NewSA = TLO.DAG.getConstant(Diff, dl, ShiftVT);
               return TLO.CombineTo(
                   Op, TLO.DAG.getNode(Opc, dl, VT, Op0.getOperand(0), NewSA));
             }