Lines Matching refs:TE
934 Optional<OrdersType> findReusedOrderedScalars(const TreeEntry &TE);
937 Optional<OrdersType> findPartiallyOrderedLoads(const TreeEntry &TE);
944 Optional<OrdersType> getReorderingData(const TreeEntry &TE, bool TopToBottom);
2104 TreeEntry *TE = nullptr; in getVectorizedOperand() local
2105 const auto *It = find_if(VL, [this, &TE](Value *V) { in getVectorizedOperand()
2106 TE = getTreeEntry(V); in getVectorizedOperand()
2107 return TE; in getVectorizedOperand()
2109 if (It != VL.end() && TE->isSame(VL)) in getVectorizedOperand()
2110 return TE; in getVectorizedOperand()
2166 isGatherShuffledEntry(const TreeEntry *TE, SmallVectorImpl<int> &Mask,
2198 collectUserStores(const BoUpSLP::TreeEntry *TE) const;
2214 findExternalStoreUsersReorderIndices(TreeEntry *TE) const;
2251 bool hasEqualOperands(const TreeEntry &TE) const { in hasEqualOperands()
2252 if (TE.getNumOperands() != getNumOperands()) in hasEqualOperands()
2260 if (getOperand(K) == TE.getOperand(I)) { in hasEqualOperands()
2570 BundleMember->TE = Last; in newTreeEntry()
2708 TE = nullptr; in init()
2748 return NextInBundle != nullptr || FirstInBundle != this || TE; in isPartOfBundle()
2817 TreeEntry *TE = nullptr; member
2983 if (TreeEntry *TE = BundleMember->TE) { in schedule() local
2985 int Lane = std::distance(TE->Scalars.begin(), in schedule()
2986 find(TE->Scalars, BundleMember->Inst)); in schedule()
2998 In->getNumOperands() == TE->getNumOperands()) && in schedule()
3002 for (unsigned OpIdx = 0, NumOperands = TE->getNumOperands(); in schedule()
3004 if (auto *I = dyn_cast<Instruction>(TE->getOperand(OpIdx)[Lane])) in schedule()
3411 BoUpSLP::findReusedOrderedScalars(const BoUpSLP::TreeEntry &TE) { in findReusedOrderedScalars() argument
3412 assert(TE.State == TreeEntry::NeedToGather && "Expected gather node only."); in findReusedOrderedScalars()
3413 unsigned NumScalars = TE.Scalars.size(); in findReusedOrderedScalars()
3422 Value *V = TE.Scalars[I]; in findReusedOrderedScalars()
3640 BoUpSLP::findPartiallyOrderedLoads(const BoUpSLP::TreeEntry &TE) { in findPartiallyOrderedLoads() argument
3641 assert(TE.State == TreeEntry::NeedToGather && "Expected gather node only."); in findPartiallyOrderedLoads()
3642 Type *ScalarTy = TE.Scalars[0]->getType(); in findPartiallyOrderedLoads()
3645 Ptrs.reserve(TE.Scalars.size()); in findPartiallyOrderedLoads()
3646 for (Value *V : TE.Scalars) { in findPartiallyOrderedLoads()
3659 Optional<BoUpSLP::OrdersType> BoUpSLP::getReorderingData(const TreeEntry &TE, in getReorderingData() argument
3663 if (!TE.ReuseShuffleIndices.empty()) in getReorderingData()
3665 if (TE.State == TreeEntry::Vectorize && in getReorderingData()
3666 (isa<LoadInst, ExtractElementInst, ExtractValueInst>(TE.getMainOp()) || in getReorderingData()
3667 (TopToBottom && isa<StoreInst, InsertElementInst>(TE.getMainOp()))) && in getReorderingData()
3668 !TE.isAltShuffle()) in getReorderingData()
3669 return TE.ReorderIndices; in getReorderingData()
3670 if (TE.State == TreeEntry::NeedToGather) { in getReorderingData()
3673 if (((TE.getOpcode() == Instruction::ExtractElement && in getReorderingData()
3674 !TE.isAltShuffle()) || in getReorderingData()
3675 (all_of(TE.Scalars, in getReorderingData()
3679 any_of(TE.Scalars, in getReorderingData()
3681 all_of(TE.Scalars, in getReorderingData()
3686 allSameType(TE.Scalars)) { in getReorderingData()
3690 bool Reuse = canReuseExtract(TE.Scalars, TE.getMainOp(), CurrentOrder); in getReorderingData()
3697 if (Optional<OrdersType> CurrentOrder = findReusedOrderedScalars(TE)) in getReorderingData()
3699 if (TE.Scalars.size() >= 4) in getReorderingData()
3700 if (Optional<OrdersType> Order = findPartiallyOrderedLoads(TE)) in getReorderingData()
3728 const std::unique_ptr<TreeEntry> &TE) { in reorderTopToBottom() argument
3731 findExternalStoreUsersReorderIndices(TE.get()); in reorderTopToBottom()
3733 VFToOrderedEntries[TE->Scalars.size()].insert(TE.get()); in reorderTopToBottom()
3734 ExternalUserReorderMap.try_emplace(TE.get(), in reorderTopToBottom()
3741 if (TE->isAltShuffle()) { in reorderTopToBottom()
3743 FixedVectorType::get(TE->Scalars[0]->getType(), TE->Scalars.size()); in reorderTopToBottom()
3744 unsigned Opcode0 = TE->getOpcode(); in reorderTopToBottom()
3745 unsigned Opcode1 = TE->getAltOpcode(); in reorderTopToBottom()
3747 SmallBitVector OpcodeMask(TE->Scalars.size(), false); in reorderTopToBottom()
3748 for (unsigned Lane : seq<unsigned>(0, TE->Scalars.size())) in reorderTopToBottom()
3749 if (cast<Instruction>(TE->Scalars[Lane])->getOpcode() == Opcode1) in reorderTopToBottom()
3753 VFToOrderedEntries[TE->Scalars.size()].insert(TE.get()); in reorderTopToBottom()
3754 AltShufflesToOrders.try_emplace(TE.get(), OrdersType()); in reorderTopToBottom()
3760 getReorderingData(*TE, /*TopToBottom=*/true)) { in reorderTopToBottom()
3769 const TreeEntry *UserTE = TE.get(); in reorderTopToBottom()
3781 VFToOrderedEntries[TE->Scalars.size()].insert(TE.get()); in reorderTopToBottom()
3782 if (TE->State != TreeEntry::Vectorize) in reorderTopToBottom()
3783 GathersToOrders.try_emplace(TE.get(), *CurrentOrder); in reorderTopToBottom()
3872 for (std::unique_ptr<TreeEntry> &TE : VectorizableTree) { in reorderTopToBottom()
3874 if (TE->Scalars.size() != VF) { in reorderTopToBottom()
3875 if (TE->ReuseShuffleIndices.size() == VF) { in reorderTopToBottom()
3879 assert(all_of(TE->UserTreeIndices, in reorderTopToBottom()
3880 [VF, &TE](const EdgeInfo &EI) { in reorderTopToBottom()
3883 TE->Scalars.size(); in reorderTopToBottom()
3888 reorderReuses(TE->ReuseShuffleIndices, Mask); in reorderTopToBottom()
3892 if (TE->State == TreeEntry::Vectorize && in reorderTopToBottom()
3894 InsertElementInst>(TE->getMainOp()) && in reorderTopToBottom()
3895 !TE->isAltShuffle()) { in reorderTopToBottom()
3898 reorderOrder(TE->ReorderIndices, Mask); in reorderTopToBottom()
3899 if (isa<InsertElementInst, StoreInst>(TE->getMainOp())) in reorderTopToBottom()
3900 TE->reorderOperands(Mask); in reorderTopToBottom()
3903 TE->reorderOperands(Mask); in reorderTopToBottom()
3904 assert(TE->ReorderIndices.empty() && in reorderTopToBottom()
3906 reorderScalars(TE->Scalars, Mask); in reorderTopToBottom()
3908 if (!TE->ReuseShuffleIndices.empty()) { in reorderTopToBottom()
3915 addMask(NewReuses, TE->ReuseShuffleIndices); in reorderTopToBottom()
3916 TE->ReuseShuffleIndices.swap(NewReuses); in reorderTopToBottom()
3932 if (TreeEntry *TE = getVectorizedOperand(UserTE, I)) { in canReorderOperands() local
3934 if (any_of(TE->UserTreeIndices, in canReorderOperands()
3939 Edges.emplace_back(I, TE); in canReorderOperands()
3945 if (TE->State != TreeEntry::Vectorize && TE->ReuseShuffleIndices.empty()) in canReorderOperands()
3946 GatherOps.push_back(TE); in canReorderOperands()
3951 [&Gather, UserTE, I](TreeEntry *TE) { in canReorderOperands() argument
3952 assert(TE->State != TreeEntry::Vectorize && in canReorderOperands()
3954 if (any_of(TE->UserTreeIndices, in canReorderOperands()
3958 assert(TE->isSame(UserTE->getOperand(I)) && in canReorderOperands()
3960 Gather = TE; in canReorderOperands()
3982 const std::unique_ptr<TreeEntry> &TE) { in reorderBottomToTop() argument
3983 if (TE->State != TreeEntry::Vectorize) in reorderBottomToTop()
3984 NonVectorized.push_back(TE.get()); in reorderBottomToTop()
3986 getReorderingData(*TE, /*TopToBottom=*/false)) { in reorderBottomToTop()
3987 OrderedEntries.insert(TE.get()); in reorderBottomToTop()
3988 if (TE->State != TreeEntry::Vectorize) in reorderBottomToTop()
3989 GathersToOrders.try_emplace(TE.get(), *CurrentOrder); in reorderBottomToTop()
4003 for (TreeEntry *TE : OrderedEntries) { in reorderBottomToTop()
4004 if (!(TE->State == TreeEntry::Vectorize || in reorderBottomToTop()
4005 (TE->State == TreeEntry::NeedToGather && in reorderBottomToTop()
4006 GathersToOrders.count(TE))) || in reorderBottomToTop()
4007 TE->UserTreeIndices.empty() || !TE->ReuseShuffleIndices.empty() || in reorderBottomToTop()
4008 !all_of(drop_begin(TE->UserTreeIndices), in reorderBottomToTop()
4009 [TE](const EdgeInfo &EI) { in reorderBottomToTop()
4010 return EI.UserTE == TE->UserTreeIndices.front().UserTE; in reorderBottomToTop()
4012 !Visited.insert(TE).second) { in reorderBottomToTop()
4013 Filtered.push_back(TE); in reorderBottomToTop()
4018 for (EdgeInfo &EI : TE->UserTreeIndices) { in reorderBottomToTop()
4023 It->second.emplace_back(EI.EdgeIdx, TE); in reorderBottomToTop()
4028 [&OrderedEntries](TreeEntry *TE) { OrderedEntries.remove(TE); }); in reorderBottomToTop() argument
4089 const TreeEntry *TE) { in reorderBottomToTop() argument
4090 if (!TE->ReorderIndices.empty() || !TE->ReuseShuffleIndices.empty() || in reorderBottomToTop()
4091 (TE->State == TreeEntry::Vectorize && TE->isAltShuffle()) || in reorderBottomToTop()
4092 (IgnoreReorder && TE->Idx == 0)) in reorderBottomToTop()
4094 if (TE->State == TreeEntry::NeedToGather) { in reorderBottomToTop()
4095 auto It = GathersToOrders.find(TE); in reorderBottomToTop()
4164 TreeEntry *TE = Op.second; in reorderBottomToTop() local
4165 OrderedEntries.remove(TE); in reorderBottomToTop()
4166 if (!VisitedOps.insert(TE).second) in reorderBottomToTop()
4168 if (TE->ReuseShuffleIndices.size() == BestOrder.size()) { in reorderBottomToTop()
4170 reorderReuses(TE->ReuseShuffleIndices, Mask); in reorderBottomToTop()
4174 if (TE->State != TreeEntry::Vectorize) in reorderBottomToTop()
4176 assert((BestOrder.size() == TE->ReorderIndices.size() || in reorderBottomToTop()
4177 TE->ReorderIndices.empty()) && in reorderBottomToTop()
4179 reorderOrder(TE->ReorderIndices, Mask); in reorderBottomToTop()
4180 if (IgnoreReorder && TE == VectorizableTree.front().get()) in reorderBottomToTop()
4285 BoUpSLP::collectUserStores(const BoUpSLP::TreeEntry *TE) const { in collectUserStores()
4287 for (unsigned Lane : seq<unsigned>(0, TE->Scalars.size())) { in collectUserStores()
4288 Value *V = TE->Scalars[Lane]; in collectUserStores()
4398 BoUpSLP::findExternalStoreUsersReorderIndices(TreeEntry *TE) const { in findExternalStoreUsersReorderIndices()
4399 unsigned NumLanes = TE->Scalars.size(); in findExternalStoreUsersReorderIndices()
4402 collectUserStores(TE); in findExternalStoreUsersReorderIndices()
4873 TreeEntry *TE = in buildTree_rec() local
4882 TE->setOperand(I, Operands); in buildTree_rec()
4891 TE->setOperand(I, Operands); in buildTree_rec()
4895 buildTree_rec(OperandsVec[OpIdx], Depth + 1, {TE, OpIdx}); in buildTree_rec()
4981 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec() local
4991 TE->setOperand(I, VectorOperands[I]); in buildTree_rec()
4993 buildTree_rec(VectorOperands[NumOps - 1], Depth + 1, {TE, NumOps - 1}); in buildTree_rec()
5005 TreeEntry *TE = nullptr; in buildTree_rec() local
5011 TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec()
5017 TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec()
5021 TE->setOperandsInOrder(); in buildTree_rec()
5025 TE = newTreeEntry(VL, TreeEntry::ScatterVectorize, Bundle, S, in buildTree_rec()
5027 TE->setOperandsInOrder(); in buildTree_rec()
5028 buildTree_rec(PointerOps, Depth + 1, {TE, 0}); in buildTree_rec()
5075 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec() local
5079 TE->setOperandsInOrder(); in buildTree_rec()
5086 buildTree_rec(Operands, Depth + 1, {TE, i}); in buildTree_rec()
5109 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec() local
5131 TE->setOperand(0, Left); in buildTree_rec()
5132 TE->setOperand(1, Right); in buildTree_rec()
5133 buildTree_rec(Left, Depth + 1, {TE, 0}); in buildTree_rec()
5134 buildTree_rec(Right, Depth + 1, {TE, 1}); in buildTree_rec()
5157 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec() local
5166 TE->setOperand(0, Left); in buildTree_rec()
5167 TE->setOperand(1, Right); in buildTree_rec()
5168 buildTree_rec(Left, Depth + 1, {TE, 0}); in buildTree_rec()
5169 buildTree_rec(Right, Depth + 1, {TE, 1}); in buildTree_rec()
5173 TE->setOperandsInOrder(); in buildTree_rec()
5180 buildTree_rec(Operands, Depth + 1, {TE, i}); in buildTree_rec()
5239 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec() local
5252 TE->setOperand(0, Operands.front()); in buildTree_rec()
5287 TE->setOperand(IndexIdx, Operands.back()); in buildTree_rec()
5290 buildTree_rec(Operands[I], Depth + 1, {TE, I}); in buildTree_rec()
5345 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, in buildTree_rec() local
5347 TE->setOperandsInOrder(); in buildTree_rec()
5348 buildTree_rec(Operands, Depth + 1, {TE, 0}); in buildTree_rec()
5352 TreeEntry *TE = in buildTree_rec() local
5355 TE->setOperandsInOrder(); in buildTree_rec()
5356 buildTree_rec(Operands, Depth + 1, {TE, 0}); in buildTree_rec()
5437 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec() local
5439 TE->setOperandsInOrder(); in buildTree_rec()
5451 buildTree_rec(Operands, Depth + 1, {TE, i}); in buildTree_rec()
5465 TreeEntry *TE = newTreeEntry(VL, Bundle /*vectorized*/, S, UserTreeIdx, in buildTree_rec() local
5506 TE->setOperand(0, Left); in buildTree_rec()
5507 TE->setOperand(1, Right); in buildTree_rec()
5508 buildTree_rec(Left, Depth + 1, {TE, 0}); in buildTree_rec()
5509 buildTree_rec(Right, Depth + 1, {TE, 1}); in buildTree_rec()
5513 TE->setOperandsInOrder(); in buildTree_rec()
5520 buildTree_rec(Operands, Depth + 1, {TE, i}); in buildTree_rec()
6542 for (const std::unique_ptr<TreeEntry> &TE : VectorizableTree) { in getEntryCost() local
6543 if (TE.get() == E) in getEntryCost()
6545 if (TE->isAltShuffle() && in getEntryCost()
6546 ((TE->getOpcode() == E->getOpcode() && in getEntryCost()
6547 TE->getAltOpcode() == E->getAltOpcode()) || in getEntryCost()
6548 (TE->getOpcode() == E->getAltOpcode() && in getEntryCost()
6549 TE->getAltOpcode() == E->getOpcode())) && in getEntryCost()
6550 TE->hasEqualOperands(*E)) in getEntryCost()
6612 auto &&AreVectorizableGathers = [this](const TreeEntry *TE, unsigned Limit) { in isFullyVectorizableTinyTree() argument
6614 return TE->State == TreeEntry::NeedToGather && in isFullyVectorizableTinyTree()
6615 !any_of(TE->Scalars, in isFullyVectorizableTinyTree()
6617 (allConstant(TE->Scalars) || isSplat(TE->Scalars) || in isFullyVectorizableTinyTree()
6618 TE->Scalars.size() < Limit || in isFullyVectorizableTinyTree()
6619 ((TE->getOpcode() == Instruction::ExtractElement || in isFullyVectorizableTinyTree()
6620 all_of(TE->Scalars, in isFullyVectorizableTinyTree()
6624 isFixedVectorShuffle(TE->Scalars, Mask)) || in isFullyVectorizableTinyTree()
6625 (TE->State == TreeEntry::NeedToGather && in isFullyVectorizableTinyTree()
6626 TE->getOpcode() == Instruction::Load && !TE->isAltShuffle())); in isFullyVectorizableTinyTree()
7043 TreeEntry &TE = *VectorizableTree[I]; in getTreeCost() local
7045 InstructionCost C = getEntryCost(&TE, VectorizedVals); in getTreeCost()
7048 << " for bundle that starts with " << *TE.Scalars[0] in getTreeCost()
7159 auto &&ResizeToVF = [this, &Cost](const TreeEntry *TE, ArrayRef<int> Mask) { in getTreeCost() argument
7162 unsigned VecVF = TE->getVectorFactor(); in getTreeCost()
7173 FixedVectorType::get(TE->getMainOp()->getType(), VecVF), OrigMask); in getTreeCost()
7177 TE->dump(); dbgs() << "SLP: Current total cost = " << Cost << "\n"); in getTreeCost()
7179 return std::make_pair(TE, true); in getTreeCost()
7181 return std::make_pair(TE, false); in getTreeCost()
7247 BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, SmallVectorImpl<int> &Mask, in isGatherShuffledEntry() argument
7251 Mask.assign(TE->Scalars.size(), UndefMaskElem); in isGatherShuffledEntry()
7256 if (EntryPtr.get() == TE) in isGatherShuffledEntry()
7272 for (Value *V : TE->Scalars) { in isGatherShuffledEntry()
7321 assert(all_of(TE->Scalars, UndefValue::classof) && in isGatherShuffledEntry()
7329 auto It = find_if(UsedTEs.front(), [TE](const TreeEntry *EntryPtr) { in isGatherShuffledEntry()
7330 return EntryPtr->isSame(TE->Scalars); in isGatherShuffledEntry()
7343 for (const TreeEntry *TE : UsedTEs.front()) in isGatherShuffledEntry() local
7344 VFToTE.try_emplace(TE->getVectorFactor(), TE); in isGatherShuffledEntry()
7345 for (const TreeEntry *TE : UsedTEs.back()) { in isGatherShuffledEntry() local
7346 auto It = VFToTE.find(TE->getVectorFactor()); in isGatherShuffledEntry()
7350 Entries.push_back(TE); in isGatherShuffledEntry()
7361 for (int I = 0, E = TE->Scalars.size(); I < E; ++I) { in isGatherShuffledEntry()
7362 Value *V = TE->Scalars[I]; in isGatherShuffledEntry()
7765 [VL](const std::unique_ptr<TreeEntry> &TE) { in createBuildVector() argument
7766 return TE->State == TreeEntry::NeedToGather && TE->isSame(VL); in createBuildVector()
9202 BundleMember->TE = nullptr; in cancelScheduling()