[llvm] r353655 - [X86] EltsFromConsecutiveLoads - replace SmallBitVector with APInt (NFC).
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 10 14:45:48 PST 2019
Author: rksimon
Date: Sun Feb 10 14:45:48 2019
New Revision: 353655
URL: http://llvm.org/viewvc/llvm-project?rev=353655&view=rev
Log:
[X86] EltsFromConsecutiveLoads - replace SmallBitVector with APInt (NFC).
Minor refactor to simplify some incoming patches to improve broadcast loads.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=353655&r1=353654&r2=353655&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Feb 10 14:45:48 2019
@@ -7273,9 +7273,9 @@ static SDValue EltsFromConsecutiveLoads(
unsigned NumElems = Elts.size();
int LastLoadedElt = -1;
- SmallBitVector LoadMask(NumElems, false);
- SmallBitVector ZeroMask(NumElems, false);
- SmallBitVector UndefMask(NumElems, false);
+ APInt LoadMask = APInt::getNullValue(NumElems);
+ APInt ZeroMask = APInt::getNullValue(NumElems);
+ APInt UndefMask = APInt::getNullValue(NumElems);
// For each element in the initializer, see if we've found a load, zero or an
// undef.
@@ -7285,11 +7285,11 @@ static SDValue EltsFromConsecutiveLoads(
return SDValue();
if (Elt.isUndef())
- UndefMask[i] = true;
+ UndefMask.setBit(i);
else if (X86::isZeroNode(Elt) || ISD::isBuildVectorAllZeros(Elt.getNode()))
- ZeroMask[i] = true;
+ ZeroMask.setBit(i);
else if (ISD::isNON_EXTLoad(Elt.getNode())) {
- LoadMask[i] = true;
+ LoadMask.setBit(i);
LastLoadedElt = i;
// Each loaded element must be the correct fractional portion of the
// requested vector load.
@@ -7298,20 +7298,21 @@ static SDValue EltsFromConsecutiveLoads(
} else
return SDValue();
}
- assert((ZeroMask | UndefMask | LoadMask).count() == NumElems &&
+ assert((ZeroMask.countPopulation() + UndefMask.countPopulation() +
+ LoadMask.countPopulation()) == NumElems &&
"Incomplete element masks");
// Handle Special Cases - all undef or undef/zero.
- if (UndefMask.count() == NumElems)
+ if (UndefMask.countPopulation() == NumElems)
return DAG.getUNDEF(VT);
// FIXME: Should we return this as a BUILD_VECTOR instead?
- if ((ZeroMask | UndefMask).count() == NumElems)
+ if ((ZeroMask.countPopulation() + UndefMask.countPopulation()) == NumElems)
return VT.isInteger() ? DAG.getConstant(0, DL, VT)
: DAG.getConstantFP(0.0, DL, VT);
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
- int FirstLoadedElt = LoadMask.find_first();
+ int FirstLoadedElt = LoadMask.countTrailingZeros();
SDValue EltBase = peekThroughBitcasts(Elts[FirstLoadedElt]);
LoadSDNode *LDBase = cast<LoadSDNode>(EltBase);
EVT LDBaseVT = EltBase.getValueType();
More information about the llvm-commits
mailing list