@@ -226,7 +226,7 @@ namespace {
226
226
227
227
// / Promotes a single AllocStackInst into registers..
228
228
class StackAllocationPromoter {
229
- using BlockSet = BasicBlockSetVector;
229
+ using BlockSetVector = BasicBlockSetVector;
230
230
using BlockToInstMap = llvm::DenseMap<SILBasicBlock *, SILInstruction *>;
231
231
232
232
// Use a priority queue keyed on dominator tree level so that inserted nodes
@@ -286,26 +286,27 @@ class StackAllocationPromoter {
286
286
void promoteAllocationToPhi ();
287
287
288
288
// / Replace the dummy nodes with new block arguments.
289
- void addBlockArguments (BlockSet &phiBlocks);
289
+ void addBlockArguments (BlockSetVector &phiBlocks);
290
290
291
291
// / Fix all of the branch instructions and the uses to use
292
292
// / the AllocStack definitions (which include stores and Phis).
293
- void fixBranchesAndUses (BlockSet &blocks);
293
+ void fixBranchesAndUses (BlockSetVector &blocks);
294
294
295
295
// / update the branch instructions with the new Phi argument.
296
296
// / The blocks in \p PhiBlocks are blocks that define a value, \p Dest is
297
297
// / the branch destination, and \p Pred is the predecessors who's branch we
298
298
// / modify.
299
- void fixPhiPredBlock (BlockSet &phiBlocks, SILBasicBlock *dest,
299
+ void fixPhiPredBlock (BlockSetVector &phiBlocks, SILBasicBlock *dest,
300
300
SILBasicBlock *pred);
301
301
302
302
// / Get the value for this AllocStack variable that is
303
303
// / flowing out of StartBB.
304
- SILValue getLiveOutValue (BlockSet &phiBlocks, SILBasicBlock *startBlock);
304
+ SILValue getLiveOutValue (BlockSetVector &phiBlocks,
305
+ SILBasicBlock *startBlock);
305
306
306
307
// / Get the value for this AllocStack variable that is
307
308
// / flowing into BB.
308
- SILValue getLiveInValue (BlockSet &phiBlocks, SILBasicBlock *block);
309
+ SILValue getLiveInValue (BlockSetVector &phiBlocks, SILBasicBlock *block);
309
310
310
311
// / Prune AllocStacks usage in the function. Scan the function
311
312
// / and remove in-block usage of the AllocStack. Leave only the first
@@ -445,14 +446,14 @@ StoreInst *StackAllocationPromoter::promoteAllocationInBlock(
445
446
return lastStore;
446
447
}
447
448
448
- void StackAllocationPromoter::addBlockArguments (BlockSet &phiBlocks) {
449
+ void StackAllocationPromoter::addBlockArguments (BlockSetVector &phiBlocks) {
449
450
LLVM_DEBUG (llvm::dbgs () << " *** Adding new block arguments.\n " );
450
451
451
452
for (auto *block : phiBlocks)
452
453
block->createPhiArgument (asi->getElementType (), OwnershipKind::Owned);
453
454
}
454
455
455
- SILValue StackAllocationPromoter::getLiveOutValue (BlockSet &phiBlocks,
456
+ SILValue StackAllocationPromoter::getLiveOutValue (BlockSetVector &phiBlocks,
456
457
SILBasicBlock *startBlock) {
457
458
LLVM_DEBUG (llvm::dbgs () << " *** Searching for a value definition.\n " );
458
459
// Walk the Dom tree in search of a defining value:
@@ -484,7 +485,7 @@ SILValue StackAllocationPromoter::getLiveOutValue(BlockSet &phiBlocks,
484
485
return SILUndef::get (asi->getElementType (), *asi->getFunction ());
485
486
}
486
487
487
- SILValue StackAllocationPromoter::getLiveInValue (BlockSet &phiBlocks,
488
+ SILValue StackAllocationPromoter::getLiveInValue (BlockSetVector &phiBlocks,
488
489
SILBasicBlock *block) {
489
490
// First, check if there is a Phi value in the current block. We know that
490
491
// our loads happen before stores, so we need to first check for Phi nodes
@@ -507,7 +508,7 @@ SILValue StackAllocationPromoter::getLiveInValue(BlockSet &phiBlocks,
507
508
return getLiveOutValue (phiBlocks, iDom->getBlock ());
508
509
}
509
510
510
- void StackAllocationPromoter::fixPhiPredBlock (BlockSet &phiBlocks,
511
+ void StackAllocationPromoter::fixPhiPredBlock (BlockSetVector &phiBlocks,
511
512
SILBasicBlock *destBlock,
512
513
SILBasicBlock *predBlock) {
513
514
TermInst *ti = predBlock->getTerminator ();
@@ -521,7 +522,7 @@ void StackAllocationPromoter::fixPhiPredBlock(BlockSet &phiBlocks,
521
522
ti->eraseFromParent ();
522
523
}
523
524
524
- void StackAllocationPromoter::fixBranchesAndUses (BlockSet &phiBlocks) {
525
+ void StackAllocationPromoter::fixBranchesAndUses (BlockSetVector &phiBlocks) {
525
526
// First update uses of the value.
526
527
SmallVector<LoadInst *, 4 > collectedLoads;
527
528
@@ -604,7 +605,7 @@ void StackAllocationPromoter::fixBranchesAndUses(BlockSet &phiBlocks) {
604
605
605
606
void StackAllocationPromoter::pruneAllocStackUsage () {
606
607
LLVM_DEBUG (llvm::dbgs () << " *** Pruning : " << *asi);
607
- BlockSet functionBlocks (asi->getFunction ());
608
+ BlockSetVector functionBlocks (asi->getFunction ());
608
609
609
610
// Insert all of the blocks that asi is live in.
610
611
for (auto *use : asi->getUses ())
@@ -625,7 +626,7 @@ void StackAllocationPromoter::promoteAllocationToPhi() {
625
626
LLVM_DEBUG (llvm::dbgs () << " *** Placing Phis for : " << *asi);
626
627
627
628
// A list of blocks that will require new Phi values.
628
- BlockSet phiBlocks (asi->getFunction ());
629
+ BlockSetVector phiBlocks (asi->getFunction ());
629
630
630
631
// The "piggy-bank" data-structure that we use for processing the dom-tree
631
632
// bottom-up.
0 commit comments