[llvm] 1c6b740 - [TargetLowering] Remove workaround for old behavior of getShiftAmountTy. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 28 14:13:35 PST 2021


Author: Craig Topper
Date: 2021-12-28T14:08:25-08:00
New Revision: 1c6b740d4b1bb8f74c8eb2fa38b21d684d32ca75

URL: https://github.com/llvm/llvm-project/commit/1c6b740d4b1bb8f74c8eb2fa38b21d684d32ca75
DIFF: https://github.com/llvm/llvm-project/commit/1c6b740d4b1bb8f74c8eb2fa38b21d684d32ca75.diff

LOG: [TargetLowering] Remove workaround for old behavior of getShiftAmountTy. NFC

getShiftAmountTy used to directly return the shift amount type from
the target which could be too small for large illegal types. For
example, X86 always returns i8.

The code here detected this and used i32 instead if it won't fit. This
behavior was added to getShiftAmountTy in D112469 so we no longer need
this workaround.

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 e6b06ab93d6b9..03163c8967995 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -6438,12 +6438,6 @@ bool TargetLowering::expandMUL_LOHI(unsigned Opcode, EVT VT, const SDLoc &dl,
 
   unsigned ShiftAmount = OuterBitSize - InnerBitSize;
   EVT ShiftAmountTy = getShiftAmountTy(VT, DAG.getDataLayout());
-  if (APInt::getMaxValue(ShiftAmountTy.getSizeInBits()).ult(ShiftAmount)) {
-    // FIXME getShiftAmountTy does not always return a sensible result when VT
-    // is an illegal type, and so the type may be too small to fit the shift
-    // amount. Override it with i32. The shift will have to be legalized.
-    ShiftAmountTy = MVT::i32;
-  }
   SDValue Shift = DAG.getConstant(ShiftAmount, dl, ShiftAmountTy);
 
   if (!LH.getNode() && !RH.getNode() &&


        


More information about the llvm-commits mailing list