Skip to content

Commit 2fdd58c

Browse files
committed
[SDAG] reduce code duplication; NFC
1 parent 3d30f2c commit 2fdd58c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3655,9 +3655,9 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
36553655
if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
36563656
unsigned ShiftBits = AndRHSC.countTrailingZeros();
36573657
auto &DL = DAG.getDataLayout();
3658-
EVT ShiftTy = getShiftAmountTy(N0.getValueType(), DL,
3658+
EVT ShiftTy = getShiftAmountTy(ShValTy, DL,
36593659
!DCI.isBeforeLegalize());
3660-
EVT CmpTy = N0.getValueType();
3660+
EVT CmpTy = ShValTy;
36613661
SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0.getOperand(0),
36623662
DAG.getConstant(ShiftBits, dl,
36633663
ShiftTy));
@@ -3686,9 +3686,9 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
36863686
if (ShiftBits && NewC.getMinSignedBits() <= 64 &&
36873687
isLegalICmpImmediate(NewC.getSExtValue())) {
36883688
auto &DL = DAG.getDataLayout();
3689-
EVT ShiftTy = getShiftAmountTy(N0.getValueType(), DL,
3689+
EVT ShiftTy = getShiftAmountTy(ShValTy, DL,
36903690
!DCI.isBeforeLegalize());
3691-
EVT CmpTy = N0.getValueType();
3691+
EVT CmpTy = ShValTy;
36923692
SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0,
36933693
DAG.getConstant(ShiftBits, dl, ShiftTy));
36943694
SDValue CmpRHS = DAG.getConstant(NewC, dl, CmpTy);

0 commit comments

Comments
 (0)