mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Small cleanup of MachineLICM.cpp
Specifically: - Calculate the loop pre-header once at the stat of HoistOutOfLoop, so: - We don't-DFS walk the MachineDomTree if we aren't going to do anything - Don't call getCurPreheader for each Scope - Don't needlessly use a do-while loop - Use early exit for Scopes.size() == 0 No functional changes intended. llvm-svn: 228350
This commit is contained in:
parent
4a4a7fcd0d
commit
1040855bc8
@ -693,6 +693,10 @@ void MachineLICM::ExitScopeIfDone(MachineDomTreeNode *Node,
|
||||
/// one pass without iteration.
|
||||
///
|
||||
void MachineLICM::HoistOutOfLoop(MachineDomTreeNode *HeaderN) {
|
||||
MachineBasicBlock *Preheader = getCurPreheader();
|
||||
if (!Preheader)
|
||||
return;
|
||||
|
||||
SmallVector<MachineDomTreeNode*, 32> Scopes;
|
||||
SmallVector<MachineDomTreeNode*, 8> WorkList;
|
||||
DenseMap<MachineDomTreeNode*, MachineDomTreeNode*> ParentMap;
|
||||
@ -700,7 +704,7 @@ void MachineLICM::HoistOutOfLoop(MachineDomTreeNode *HeaderN) {
|
||||
|
||||
// Perform a DFS walk to determine the order of visit.
|
||||
WorkList.push_back(HeaderN);
|
||||
do {
|
||||
while (!WorkList.empty()) {
|
||||
MachineDomTreeNode *Node = WorkList.pop_back_val();
|
||||
assert(Node && "Null dominator tree node?");
|
||||
MachineBasicBlock *BB = Node->getBlock();
|
||||
@ -734,28 +738,21 @@ void MachineLICM::HoistOutOfLoop(MachineDomTreeNode *HeaderN) {
|
||||
ParentMap[Child] = Node;
|
||||
WorkList.push_back(Child);
|
||||
}
|
||||
} while (!WorkList.empty());
|
||||
|
||||
if (Scopes.size() != 0) {
|
||||
MachineBasicBlock *Preheader = getCurPreheader();
|
||||
if (!Preheader)
|
||||
return;
|
||||
|
||||
// Compute registers which are livein into the loop headers.
|
||||
RegSeen.clear();
|
||||
BackTrace.clear();
|
||||
InitRegPressure(Preheader);
|
||||
}
|
||||
|
||||
if (Scopes.size() == 0)
|
||||
return;
|
||||
|
||||
// Compute registers which are livein into the loop headers.
|
||||
RegSeen.clear();
|
||||
BackTrace.clear();
|
||||
InitRegPressure(Preheader);
|
||||
|
||||
// Now perform LICM.
|
||||
for (unsigned i = 0, e = Scopes.size(); i != e; ++i) {
|
||||
MachineDomTreeNode *Node = Scopes[i];
|
||||
MachineBasicBlock *MBB = Node->getBlock();
|
||||
|
||||
MachineBasicBlock *Preheader = getCurPreheader();
|
||||
if (!Preheader)
|
||||
continue;
|
||||
|
||||
EnterScope(MBB);
|
||||
|
||||
// Process the block
|
||||
|
Loading…
Reference in New Issue
Block a user