@@ -1243,11 +1243,13 @@ class BoUpSLP {
12431243 StridedVectorize
12441244 };
12451245
1246- using ValueList = SmallVector<Value *, 4>;
1247- using ValueSet = SmallPtrSet<Value *, 8>;
1246+ using ValueList = SmallVector<Value *, 8>;
1247+ using InstrList = SmallVector<Instruction *, 16>;
1248+ 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 ///
@@ -3106,7 +3108,7 @@ class BoUpSLP {
31063108 /// The operands of each instruction in each lane Operands[op_index][lane].
31073109 /// Note: This helps avoid the replication of the code that performs the
31083110 /// reordering of operands during buildTree_rec() and vectorizeTree().
3109- SmallVector<ValueList, 0 > Operands;
3111+ SmallVector<ValueList, 2 > Operands;
31103112
31113113 /// The main/alternate instruction.
31123114 Instruction *MainOp = nullptr;
@@ -3714,13 +3716,13 @@ class BoUpSLP {
37143716
37153717 /// The dependent memory instructions.
37163718 /// This list is derived on demand in calculateDependencies().
3717- SmallVector<ScheduleData *, 0 > MemoryDependencies;
3719+ SmallVector<ScheduleData *, 4 > MemoryDependencies;
37183720
37193721 /// List of instructions which this instruction could be control dependent
37203722 /// on. Allowing such nodes to be scheduled below this one could introduce
37213723 /// a runtime fault which didn't exist in the original program.
37223724 /// ex: this is a load or udiv following a readonly call which inf loops
3723- SmallVector<ScheduleData *, 0 > ControlDependencies;
3725+ SmallVector<ScheduleData *, 4 > ControlDependencies;
37243726
37253727 /// This ScheduleData is in the current scheduling region if this matches
37263728 /// the current SchedulingRegionID of BlockScheduling.
@@ -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
46954697BoUpSLP::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
77177719bool 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