[llvm] 2fdd58c - [SDAG] reduce code duplication; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 07:15:24 PST 2019


Author: Sanjay Patel
Date: 2019-11-07T10:15:17-05:00
New Revision: 2fdd58c5066fc1b13dec39383f17095009131ff8

URL: https://github.com/llvm/llvm-project/commit/2fdd58c5066fc1b13dec39383f17095009131ff8
DIFF: https://github.com/llvm/llvm-project/commit/2fdd58c5066fc1b13dec39383f17095009131ff8.diff

LOG: [SDAG] reduce code duplication; NFC

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 2ded5674bbb6..000819b0b6d9 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -3655,9 +3655,9 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
           if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
             unsigned ShiftBits = AndRHSC.countTrailingZeros();
             auto &DL = DAG.getDataLayout();
-            EVT ShiftTy = getShiftAmountTy(N0.getValueType(), DL,
+            EVT ShiftTy = getShiftAmountTy(ShValTy, DL,
                                            !DCI.isBeforeLegalize());
-            EVT CmpTy = N0.getValueType();
+            EVT CmpTy = ShValTy;
             SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0.getOperand(0),
                                         DAG.getConstant(ShiftBits, dl,
                                                         ShiftTy));
@@ -3686,9 +3686,9 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
         if (ShiftBits && NewC.getMinSignedBits() <= 64 &&
           isLegalICmpImmediate(NewC.getSExtValue())) {
           auto &DL = DAG.getDataLayout();
-          EVT ShiftTy = getShiftAmountTy(N0.getValueType(), DL,
+          EVT ShiftTy = getShiftAmountTy(ShValTy, DL,
                                          !DCI.isBeforeLegalize());
-          EVT CmpTy = N0.getValueType();
+          EVT CmpTy = ShValTy;
           SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0,
                                       DAG.getConstant(ShiftBits, dl, ShiftTy));
           SDValue CmpRHS = DAG.getConstant(NewC, dl, CmpTy);


        


More information about the llvm-commits mailing list