[llvm] 8705912 - [SDAG] remove duplicate functionality when getting shift type for demanded bits; NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 18 09:14:20 PST 2022
Author: Sanjay Patel
Date: 2022-01-18T12:13:45-05:00
New Revision: 870591200dc83e2ed4b4f6cf4ec03074d0d1a084
URL: https://github.com/llvm/llvm-project/commit/870591200dc83e2ed4b4f6cf4ec03074d0d1a084
DIFF: https://github.com/llvm/llvm-project/commit/870591200dc83e2ed4b4f6cf4ec03074d0d1a084.diff
LOG: [SDAG] remove duplicate functionality when getting shift type for demanded bits; NFCI
This was noted as a potential cleanup in D117508.
getShiftAmountTy() has checks for vector, phase, etc. so it should
handle anything that the caller was trying to account for.
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 b683f33c3c81..6af560999379 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1869,12 +1869,8 @@ bool TargetLowering::SimplifyDemandedBits(
if (!AlreadySignExtended) {
// Compute the correct shift amount type, which must be getShiftAmountTy
// for scalar types after legalization.
- EVT ShiftAmtTy = VT;
- if (TLO.LegalTypes() && !ShiftAmtTy.isVector())
- ShiftAmtTy = getShiftAmountTy(ShiftAmtTy, DL);
-
- SDValue ShiftAmt =
- TLO.DAG.getConstant(BitWidth - ExVTBits, dl, ShiftAmtTy);
+ SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ExVTBits, dl,
+ getShiftAmountTy(VT, DL));
return TLO.CombineTo(Op,
TLO.DAG.getNode(ISD::SHL, dl, VT, Op0, ShiftAmt));
}
More information about the llvm-commits
mailing list