mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Mem2Reg] NFC: Lifted livePhiBlocks into caller.
Previously, the value was computed and destroyed during `promoteAllocationInBlock`. Make the value available in `StackAllocationPromoter`'s top-level routine (`::run`) in preparation for using it there.
This commit is contained in:
@@ -938,7 +938,7 @@ public:
|
||||
|
||||
private:
|
||||
/// Promote AllocStacks into SSA.
|
||||
void promoteAllocationToPhi();
|
||||
void promoteAllocationToPhi(BlockSetVector &livePhiBlocks);
|
||||
|
||||
/// Replace the dummy nodes with new block arguments.
|
||||
void addBlockArguments(BlockSetVector &phiBlocks);
|
||||
@@ -1685,7 +1685,8 @@ void StackAllocationPromoter::pruneAllocStackUsage() {
|
||||
LLVM_DEBUG(llvm::dbgs() << "*** Finished pruning : " << *asi);
|
||||
}
|
||||
|
||||
void StackAllocationPromoter::promoteAllocationToPhi() {
|
||||
void StackAllocationPromoter::promoteAllocationToPhi(
|
||||
BlockSetVector &livePhiBlocks) {
|
||||
LLVM_DEBUG(llvm::dbgs() << "*** Placing Phis for : " << *asi);
|
||||
|
||||
// A list of blocks that will require new Phi values.
|
||||
@@ -1781,10 +1782,6 @@ void StackAllocationPromoter::promoteAllocationToPhi() {
|
||||
// Replace the dummy values with new block arguments.
|
||||
addBlockArguments(phiBlocks);
|
||||
|
||||
// The blocks which still have new phis after fixBranchesAndUses runs. These
|
||||
// are not necessarily the same as phiBlocks because fixBranchesAndUses
|
||||
// removes superfluous proactive phis.
|
||||
BlockSetVector livePhiBlocks(asi->getFunction());
|
||||
// Hook up the Phi nodes, loads, and debug_value_addr with incoming values.
|
||||
fixBranchesAndUses(phiBlocks, livePhiBlocks);
|
||||
|
||||
@@ -1801,8 +1798,13 @@ void StackAllocationPromoter::run() {
|
||||
// per block and the last store is recorded.
|
||||
pruneAllocStackUsage();
|
||||
|
||||
// The blocks which still have new phis after fixBranchesAndUses runs. These
|
||||
// are not necessarily the same as phiBlocks because fixBranchesAndUses
|
||||
// removes superfluous proactive phis.
|
||||
BlockSetVector livePhiBlocks(asi->getFunction());
|
||||
|
||||
// Replace AllocStacks with Phi-nodes.
|
||||
promoteAllocationToPhi();
|
||||
promoteAllocationToPhi(livePhiBlocks);
|
||||
|
||||
// Make sure that all of the allocations were promoted into registers.
|
||||
assert(isWriteOnlyAllocation(asi) && "Non-write uses left behind");
|
||||
|
||||
Reference in New Issue
Block a user