mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-10 22:43:46 +00:00
TailDuplication: Record blocks that received the duplicated block. NFC.
This will allow tail duplication during layout to handle the cfg changes more cleanly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279858 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7921d70074
commit
db440c8640
@ -57,7 +57,13 @@ public:
|
||||
bool shouldTailDuplicate(bool IsSimple, MachineBasicBlock &TailBB);
|
||||
/// Returns true if TailBB can successfully be duplicated into PredBB
|
||||
bool canTailDuplicate(MachineBasicBlock *TailBB, MachineBasicBlock *PredBB);
|
||||
bool tailDuplicateAndUpdate(bool IsSimple, MachineBasicBlock *MBB);
|
||||
/// Tail duplicate a single basic block into its predecessors, and then clean
|
||||
/// up.
|
||||
/// If \p DuplicatePreds is not null, it will be updated to contain the list
|
||||
/// of predecessors that received a copy of \p MBB.
|
||||
bool tailDuplicateAndUpdate(
|
||||
bool IsSimple, MachineBasicBlock *MBB,
|
||||
SmallVectorImpl<MachineBasicBlock*> *DuplicatedPreds = nullptr);
|
||||
|
||||
private:
|
||||
typedef TargetInstrInfo::RegSubRegPair RegSubRegPair;
|
||||
|
@ -119,8 +119,13 @@ static void VerifyPHIs(MachineFunction &MF, bool CheckExtra) {
|
||||
}
|
||||
|
||||
/// Tail duplicate the block and cleanup.
|
||||
bool TailDuplicator::tailDuplicateAndUpdate(bool IsSimple,
|
||||
MachineBasicBlock *MBB) {
|
||||
/// \p IsSimple - return value of isSimpleBB
|
||||
/// \p MBB - block to be duplicated
|
||||
/// \p DuplicatedPreds - if non-null, \p DuplicatedPreds will contain a list of
|
||||
/// all Preds that received a copy of \p MBB.
|
||||
bool TailDuplicator::tailDuplicateAndUpdate(
|
||||
bool IsSimple, MachineBasicBlock *MBB,
|
||||
SmallVectorImpl<MachineBasicBlock*> *DuplicatedPreds) {
|
||||
// Save the successors list.
|
||||
SmallSetVector<MachineBasicBlock *, 8> Succs(MBB->succ_begin(),
|
||||
MBB->succ_end());
|
||||
@ -216,6 +221,9 @@ bool TailDuplicator::tailDuplicateAndUpdate(bool IsSimple,
|
||||
if (NewPHIs.size())
|
||||
NumAddedPHIs += NewPHIs.size();
|
||||
|
||||
if (DuplicatedPreds)
|
||||
*DuplicatedPreds = std::move(TDBBs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user