@@ -198,7 +198,9 @@ class SROA {
198
198
SmallSetVector<AllocaInst *, 16 > PostPromotionWorklist;
199
199
200
200
// / A collection of alloca instructions we can directly promote.
201
- SmallPtrSet<AllocaInst *, 16 > PromotableAllocas;
201
+ SetVector<AllocaInst *, SmallVector<AllocaInst *>,
202
+ SmallPtrSet<AllocaInst *, 16 >, 16 >
203
+ PromotableAllocas;
202
204
203
205
// / A worklist of PHIs to speculate prior to promoting allocas.
204
206
// /
@@ -4799,8 +4801,7 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
4799
4801
4800
4802
// Finally, don't try to promote any allocas that new require re-splitting.
4801
4803
// They have already been added to the worklist above.
4802
- for (auto *RPA : ResplitPromotableAllocas)
4803
- PromotableAllocas.erase (RPA);
4804
+ PromotableAllocas.set_subtract (ResplitPromotableAllocas);
4804
4805
4805
4806
return true ;
4806
4807
}
@@ -5597,9 +5598,7 @@ bool SROA::promoteAllocas(Function &F) {
5597
5598
LLVM_DEBUG (dbgs () << " Not promoting allocas with mem2reg!\n " );
5598
5599
} else {
5599
5600
LLVM_DEBUG (dbgs () << " Promoting allocas with mem2reg...\n " );
5600
- PromoteMemToReg (
5601
- std::vector (PromotableAllocas.begin (), PromotableAllocas.end ()),
5602
- DTU->getDomTree (), AC);
5601
+ PromoteMemToReg (PromotableAllocas.getArrayRef (), DTU->getDomTree (), AC);
5603
5602
}
5604
5603
5605
5604
PromotableAllocas.clear ();
@@ -5642,8 +5641,7 @@ std::pair<bool /*Changed*/, bool /*CFGChanged*/> SROA::runSROA(Function &F) {
5642
5641
if (!DeletedAllocas.empty ()) {
5643
5642
Worklist.set_subtract (DeletedAllocas);
5644
5643
PostPromotionWorklist.set_subtract (DeletedAllocas);
5645
- for (auto *DA : DeletedAllocas)
5646
- PromotableAllocas.erase (DA);
5644
+ PromotableAllocas.set_subtract (DeletedAllocas);
5647
5645
DeletedAllocas.clear ();
5648
5646
}
5649
5647
}
0 commit comments