File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -20544,20 +20544,15 @@ class RelatedStoreInsts {
20544
20544
20545
20545
/// Remove all stores that have been vectorized from this group.
20546
20546
void clearVectorizedStores(const BoUpSLP::ValueSet &VectorizedStores) {
20547
- const auto Begin = Instrs.begin();
20548
- auto NonVectorizedStore = Instrs.end();
20549
-
20550
- while (NonVectorizedStore != Begin) {
20551
- const auto Prev = std::prev(NonVectorizedStore);
20552
- unsigned InstrIdx = Prev->second;
20553
- if (VectorizedStores.contains(AllStores[InstrIdx])) {
20554
- // NonVectorizedStore is the last scalar instruction.
20555
- // Erase all stores before it so we don't try to vectorize them again.
20556
- Instrs.erase(Begin, NonVectorizedStore);
20557
- return;
20558
- }
20559
- NonVectorizedStore = Prev;
20560
- }
20547
+ DistToInstMap::reverse_iterator LastVectorizedStore = find_if(
20548
+ reverse(Instrs), [&](const std::pair<int, unsigned> &DistAndIdx) {
20549
+ return VectorizedStores.contains(AllStores[DistAndIdx.second]);
20550
+ });
20551
+
20552
+ // Get a forward iterator pointing after the last vectorized store and erase
20553
+ // all stores before it so we don't try to vectorize them again.
20554
+ DistToInstMap::iterator VectorizedStoresEnd = LastVectorizedStore.base();
20555
+ Instrs.erase(Instrs.begin(), VectorizedStoresEnd);
20561
20556
}
20562
20557
20563
20558
private:
You can’t perform that action at this time.
0 commit comments