[llvm] [Codegen][LegalizeIntegerTypes] Improve shift through stack (PR #96151)
Björn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 04:23:48 PDT 2024
================
@@ -4530,14 +4530,23 @@ void DAGTypeLegalizer::ExpandIntRes_ShiftThroughStack(SDNode *N, SDValue &Lo,
SDValue ShAmt = N->getOperand(1);
EVT ShAmtVT = ShAmt.getValueType();
- // This legalization is optimal when the shift is by a multiple of byte width,
- // %x * 8 <-> %x << 3 so 3 low bits should be be known zero.
- bool ShiftByByteMultiple =
- DAG.computeKnownBits(ShAmt).countMinTrailingZeros() >= 3;
+ EVT LoadVT = VT;
+ do {
+ LoadVT = TLI.getTypeToTransformTo(*DAG.getContext(), LoadVT);
+ } while (!TLI.isTypeLegal(LoadVT));
+
+ const unsigned ShiftUnitInBits = LoadVT.getStoreSize() * 8;
----------------
bjope wrote:
I think this could use getStoreSizeInBits().
(Unless you want to highlight that it needs to match with all the 8's and 3's below for some reason.)
https://github.com/llvm/llvm-project/pull/96151
More information about the llvm-commits
mailing list