@@ -2708,10 +2708,11 @@ SDValue SelectionDAGLegalize::ExpandBSWAP(SDValue Op, const SDLoc &dl) {
2708
2708
// / Expand the specified bitcount instruction into operations.
2709
2709
SDValue SelectionDAGLegalize::ExpandBitCount (unsigned Opc, SDValue Op,
2710
2710
const SDLoc &dl) {
2711
+ EVT VT = Op.getValueType ();
2712
+
2711
2713
switch (Opc) {
2712
2714
default : llvm_unreachable (" Cannot expand this yet!" );
2713
2715
case ISD::CTPOP: {
2714
- EVT VT = Op.getValueType ();
2715
2716
EVT ShVT = TLI.getShiftAmountTy (VT, DAG.getDataLayout ());
2716
2717
unsigned Len = VT.getSizeInBits ();
2717
2718
@@ -2758,9 +2759,8 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op,
2758
2759
}
2759
2760
case ISD::CTLZ_ZERO_UNDEF:
2760
2761
// This trivially expands to CTLZ.
2761
- return DAG.getNode (ISD::CTLZ, dl, Op. getValueType () , Op);
2762
+ return DAG.getNode (ISD::CTLZ, dl, VT , Op);
2762
2763
case ISD::CTLZ: {
2763
- EVT VT = Op.getValueType ();
2764
2764
unsigned Len = VT.getScalarSizeInBits ();
2765
2765
2766
2766
if (TLI.isOperationLegalOrCustom (ISD::CTLZ_ZERO_UNDEF, VT)) {
@@ -2792,9 +2792,8 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op,
2792
2792
}
2793
2793
case ISD::CTTZ_ZERO_UNDEF:
2794
2794
// This trivially expands to CTTZ.
2795
- return DAG.getNode (ISD::CTTZ, dl, Op. getValueType () , Op);
2795
+ return DAG.getNode (ISD::CTTZ, dl, VT , Op);
2796
2796
case ISD::CTTZ: {
2797
- EVT VT = Op.getValueType ();
2798
2797
unsigned Len = VT.getSizeInBits ();
2799
2798
2800
2799
if (TLI.isOperationLegalOrCustom (ISD::CTTZ_ZERO_UNDEF, VT)) {
@@ -2818,7 +2817,7 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op,
2818
2817
if (!TLI.isOperationLegalOrCustom (ISD::CTPOP, VT) &&
2819
2818
TLI.isOperationLegalOrCustom (ISD::CTLZ, VT))
2820
2819
return DAG.getNode (ISD::SUB, dl, VT,
2821
- DAG.getConstant (VT. getSizeInBits () , dl, VT),
2820
+ DAG.getConstant (Len , dl, VT),
2822
2821
DAG.getNode (ISD::CTLZ, dl, VT, Tmp3));
2823
2822
return DAG.getNode (ISD::CTPOP, dl, VT, Tmp3);
2824
2823
}
0 commit comments