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 @@ -20902,20 +20902,15 @@ class RelatedStoreInsts {
20902
20902
20903
20903
/// Remove all stores that have been vectorized from this group.
20904
20904
void clearVectorizedStores(const BoUpSLP::ValueSet &VectorizedStores) {
20905
- const auto Begin = Instrs.begin();
20906
- auto NonVectorizedStore = Instrs.end();
20907
-
20908
- while (NonVectorizedStore != Begin) {
20909
- const auto Prev = std::prev(NonVectorizedStore);
20910
- unsigned InstrIdx = Prev->second;
20911
- if (VectorizedStores.contains(AllStores[InstrIdx])) {
20912
- // NonVectorizedStore is the last scalar instruction.
20913
- // Erase all stores before it so we don't try to vectorize them again.
20914
- Instrs.erase(Begin, NonVectorizedStore);
20915
- return;
20916
- }
20917
- NonVectorizedStore = Prev;
20918
- }
20905
+ DistToInstMap::reverse_iterator LastVectorizedStore = find_if(
20906
+ reverse(Instrs), [&](const std::pair<int, unsigned> &DistAndIdx) {
20907
+ return VectorizedStores.contains(AllStores[DistAndIdx.second]);
20908
+ });
20909
+
20910
+ // Get a forward iterator pointing after the last vectorized store and erase
20911
+ // all stores before it so we don't try to vectorize them again.
20912
+ DistToInstMap::iterator VectorizedStoresEnd = LastVectorizedStore.base();
20913
+ Instrs.erase(Instrs.begin(), VectorizedStoresEnd);
20919
20914
}
20920
20915
20921
20916
private:
You can’t perform that action at this time.
0 commit comments