[llvm] [DAGCombiner][ARM] Teach reduceLoadWidth to handle (and (srl (load), C, ShiftedMask)) (PR #80342)
Björn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 2 04:05:37 PST 2024
================
@@ -14315,6 +14316,18 @@ SDValue DAGCombiner::reduceLoadWidth(SDNode *N) {
if ((ExtVT.getScalarSizeInBits() > MaskedVT.getScalarSizeInBits()) &&
TLI.isLoadExtLegal(ExtType, SRL.getValueType(), MaskedVT))
ExtVT = MaskedVT;
+ } else if (ExtType == ISD::ZEXTLOAD &&
+ ShiftMask.isShiftedMask(Offset, ActiveBits) &&
+ (Offset + ShAmt) < VT.getSizeInBits()) {
+ EVT MaskedVT = EVT::getIntegerVT(*DAG.getContext(), ActiveBits);
+ // If the mask is shifted we can use a narrower load and a shl to insert
+ // the trailing zeros.
+ if (((Offset + ActiveBits) <= ExtVT.getSizeInBits()) &&
----------------
bjope wrote:
It is actually guarded on line 14189 (there is an early out for vector loads).
https://github.com/llvm/llvm-project/pull/80342
More information about the llvm-commits
mailing list