Skip to content

Commit b6bb208

Browse files
committed
Revert "[SLP][NFC]Remove unused using declarations, reduce mem usage in containers, NFC"
This reverts commit 2d52eb6 to fix compile time regression found in https://llvm-compile-time-tracker.com/compare.php?from=fcefe957ddfdc5a2fe9463757b597635e3436e01&to=2d52eb6a434fe47e67086f5ec1c3789bf6e7a604&stat=instructions%3Au.
1 parent afa0f53 commit b6bb208

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,10 +1244,12 @@ class BoUpSLP {
12441244
};
12451245

12461246
using ValueList = SmallVector<Value *, 8>;
1247+
using InstrList = SmallVector<Instruction *, 16>;
12471248
using ValueSet = SmallPtrSet<Value *, 16>;
1249+
using StoreList = SmallVector<StoreInst *, 8>;
12481250
using ExtraValueToDebugLocsMap =
12491251
MapVector<Value *, SmallVector<Instruction *, 2>>;
1250-
using OrdersType = SmallVector<unsigned, 0>;
1252+
using OrdersType = SmallVector<unsigned, 4>;
12511253

12521254
BoUpSLP(Function *Func, ScalarEvolution *Se, TargetTransformInfo *Tti,
12531255
TargetLibraryInfo *TLi, AAResults *Aa, LoopInfo *Li,
@@ -1469,7 +1471,7 @@ class BoUpSLP {
14691471
/// \param TryRecursiveCheck used to check if long masked gather can be
14701472
/// represented as a serie of loads/insert subvector, if profitable.
14711473
LoadsState canVectorizeLoads(ArrayRef<Value *> VL, const Value *VL0,
1472-
OrdersType &Order,
1474+
SmallVectorImpl<unsigned> &Order,
14731475
SmallVectorImpl<Value *> &PointerOps,
14741476
bool TryRecursiveCheck = true) const;
14751477

@@ -2838,7 +2840,7 @@ class BoUpSLP {
28382840
/// \param ResizeAllowed indicates whether it is allowed to handle subvector
28392841
/// extract order.
28402842
bool canReuseExtract(ArrayRef<Value *> VL, Value *OpValue,
2841-
OrdersType &CurrentOrder,
2843+
SmallVectorImpl<unsigned> &CurrentOrder,
28422844
bool ResizeAllowed = false) const;
28432845

28442846
/// Vectorize a single entry in the tree.
@@ -3082,10 +3084,10 @@ class BoUpSLP {
30823084
CombinedOpcode CombinedOp = NotCombinedOp;
30833085

30843086
/// Does this sequence require some shuffling?
3085-
SmallVector<int, 0> ReuseShuffleIndices;
3087+
SmallVector<int, 4> ReuseShuffleIndices;
30863088

30873089
/// Does this entry require reordering?
3088-
OrdersType ReorderIndices;
3090+
SmallVector<unsigned, 4> ReorderIndices;
30893091

30903092
/// Points back to the VectorizableTree.
30913093
///
@@ -4298,12 +4300,12 @@ static void reorderReuses(SmallVectorImpl<int> &Reuses, ArrayRef<int> Mask) {
42984300
/// the original order of the scalars. Procedure transforms the provided order
42994301
/// in accordance with the given \p Mask. If the resulting \p Order is just an
43004302
/// identity order, \p Order is cleared.
4301-
static void reorderOrder(BoUpSLP::OrdersType &Order, ArrayRef<int> Mask,
4303+
static void reorderOrder(SmallVectorImpl<unsigned> &Order, ArrayRef<int> Mask,
43024304
bool BottomOrder = false) {
43034305
assert(!Mask.empty() && "Expected non-empty mask.");
43044306
unsigned Sz = Mask.size();
43054307
if (BottomOrder) {
4306-
BoUpSLP::OrdersType PrevOrder;
4308+
SmallVector<unsigned> PrevOrder;
43074309
if (Order.empty()) {
43084310
PrevOrder.resize(Sz);
43094311
std::iota(PrevOrder.begin(), PrevOrder.end(), 0);
@@ -4693,7 +4695,7 @@ getShuffleCost(const TargetTransformInfo &TTI, TTI::ShuffleKind Kind,
46934695
}
46944696

46954697
BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
4696-
ArrayRef<Value *> VL, const Value *VL0, OrdersType &Order,
4698+
ArrayRef<Value *> VL, const Value *VL0, SmallVectorImpl<unsigned> &Order,
46974699
SmallVectorImpl<Value *> &PointerOps, bool TryRecursiveCheck) const {
46984700
// Check that a vectorized load would load the same memory as a scalar
46994701
// load. For example, we don't want to vectorize loads that are smaller
@@ -4821,7 +4823,7 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
48214823
for (unsigned Cnt = 0, End = VL.size(); Cnt + VF <= End;
48224824
Cnt += VF, ++VectorizedCnt) {
48234825
ArrayRef<Value *> Slice = VL.slice(Cnt, VF);
4824-
OrdersType Order;
4826+
SmallVector<unsigned> Order;
48254827
SmallVector<Value *> PointerOps;
48264828
LoadsState LS =
48274829
canVectorizeLoads(Slice, Slice.front(), Order, PointerOps,
@@ -5395,7 +5397,7 @@ void BoUpSLP::reorderNodeWithReuses(TreeEntry &TE, ArrayRef<int> Mask) const {
53955397
TE.ReorderIndices.clear();
53965398
// Try to improve gathered nodes with clustered reuses, if possible.
53975399
ArrayRef<int> Slice = ArrayRef(NewMask).slice(0, Sz);
5398-
OrdersType NewOrder(Slice);
5400+
SmallVector<unsigned> NewOrder(Slice);
53995401
inversePermutation(NewOrder, NewMask);
54005402
reorderScalars(TE.Scalars, NewMask);
54015403
// Fill the reuses mask with the identity submasks.
@@ -7715,7 +7717,7 @@ unsigned BoUpSLP::canMapToVector(Type *T) const {
77157717
}
77167718

77177719
bool BoUpSLP::canReuseExtract(ArrayRef<Value *> VL, Value *OpValue,
7718-
OrdersType &CurrentOrder,
7720+
SmallVectorImpl<unsigned> &CurrentOrder,
77197721
bool ResizeAllowed) const {
77207722
const auto *It = find_if(VL, IsaPred<ExtractElementInst, ExtractValueInst>);
77217723
assert(It != VL.end() && "Expected at least one extract instruction.");

0 commit comments

Comments
 (0)