[X86] EltsFromConsecutiveLoads - pull out repeated NumLoadedElts. NFCI.

This commit is contained in:
Simon Pilgrim 2020-12-02 12:34:57 +00:00
parent 21d74172df
commit 0dab7ecc5d
1 changed files with 3 additions and 2 deletions

View File

@ -8414,7 +8414,8 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef<SDValue> Elts,
assert(LDBase && "Did not find base load for merging consecutive loads"); assert(LDBase && "Did not find base load for merging consecutive loads");
unsigned BaseSizeInBits = EltBaseVT.getStoreSizeInBits(); unsigned BaseSizeInBits = EltBaseVT.getStoreSizeInBits();
unsigned BaseSizeInBytes = BaseSizeInBits / 8; unsigned BaseSizeInBytes = BaseSizeInBits / 8;
int LoadSizeInBits = (1 + LastLoadedElt - FirstLoadedElt) * BaseSizeInBits; int NumLoadedElts = (1 + LastLoadedElt - FirstLoadedElt);
int LoadSizeInBits = NumLoadedElts * BaseSizeInBits;
assert((BaseSizeInBits % 8) == 0 && "Sub-byte element loads detected"); assert((BaseSizeInBits % 8) == 0 && "Sub-byte element loads detected");
// TODO: Support offsetting the base load. // TODO: Support offsetting the base load.
@ -8476,7 +8477,7 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef<SDValue> Elts,
// base pointer. If the vector contains zeros, then attempt to shuffle those // base pointer. If the vector contains zeros, then attempt to shuffle those
// elements. // elements.
if (FirstLoadedElt == 0 && if (FirstLoadedElt == 0 &&
(LastLoadedElt == (int)(NumElems - 1) || IsDereferenceable) && (NumLoadedElts == (int)NumElems || IsDereferenceable) &&
(IsConsecutiveLoad || IsConsecutiveLoadWithZeros)) { (IsConsecutiveLoad || IsConsecutiveLoadWithZeros)) {
if (isAfterLegalize && !TLI.isOperationLegal(ISD::LOAD, VT)) if (isAfterLegalize && !TLI.isOperationLegal(ISD::LOAD, VT))
return SDValue(); return SDValue();