mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
Now that dominator tree children are built in determinstic order, this horrible code
can go away git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14254 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fab8596459
commit
56b7ee20da
@ -40,7 +40,6 @@
|
|||||||
#include "llvm/Analysis/AliasSetTracker.h"
|
#include "llvm/Analysis/AliasSetTracker.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/StableBasicBlockNumbering.h"
|
|
||||||
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
@ -82,7 +81,6 @@ namespace {
|
|||||||
LoopInfo *LI; // Current LoopInfo
|
LoopInfo *LI; // Current LoopInfo
|
||||||
DominatorTree *DT; // Dominator Tree for the current Loop...
|
DominatorTree *DT; // Dominator Tree for the current Loop...
|
||||||
DominanceFrontier *DF; // Current Dominance Frontier
|
DominanceFrontier *DF; // Current Dominance Frontier
|
||||||
StableBasicBlockNumbering *BBNum; // Stable IDs for basic blocks
|
|
||||||
|
|
||||||
// State that is updated as we process loops
|
// State that is updated as we process loops
|
||||||
bool Changed; // Set to true when we change anything.
|
bool Changed; // Set to true when we change anything.
|
||||||
@ -205,7 +203,7 @@ FunctionPass *llvm::createLICMPass() { return new LICM(); }
|
|||||||
/// runOnFunction - For LICM, this simply traverses the loop structure of the
|
/// runOnFunction - For LICM, this simply traverses the loop structure of the
|
||||||
/// function, hoisting expressions out of loops if possible.
|
/// function, hoisting expressions out of loops if possible.
|
||||||
///
|
///
|
||||||
bool LICM::runOnFunction(Function &F) {
|
bool LICM::runOnFunction(Function &) {
|
||||||
Changed = false;
|
Changed = false;
|
||||||
|
|
||||||
// Get our Loop and Alias Analysis information...
|
// Get our Loop and Alias Analysis information...
|
||||||
@ -214,10 +212,6 @@ bool LICM::runOnFunction(Function &F) {
|
|||||||
DF = &getAnalysis<DominanceFrontier>();
|
DF = &getAnalysis<DominanceFrontier>();
|
||||||
DT = &getAnalysis<DominatorTree>();
|
DT = &getAnalysis<DominatorTree>();
|
||||||
|
|
||||||
// Get a stable numbering of basic blocks.
|
|
||||||
StableBasicBlockNumbering CurBBNum(&F);
|
|
||||||
BBNum = &CurBBNum;
|
|
||||||
|
|
||||||
// Hoist expressions out of all of the top-level loops.
|
// Hoist expressions out of all of the top-level loops.
|
||||||
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) {
|
for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) {
|
||||||
AliasSetTracker AST(*AA);
|
AliasSetTracker AST(*AA);
|
||||||
@ -343,16 +337,8 @@ void LICM::HoistRegion(DominatorTree::Node *N) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<DominatorTree::Node*> &Children = N->getChildren();
|
const std::vector<DominatorTree::Node*> &Children = N->getChildren();
|
||||||
std::vector<std::pair<unsigned, DominatorTree::Node*> > ChildrenWithIDs;
|
|
||||||
ChildrenWithIDs.reserve(Children.size());
|
|
||||||
for (unsigned i = 0, e = Children.size(); i != e; ++i) {
|
|
||||||
unsigned ID = BBNum->getNumber(Children[i]->getBlock());
|
|
||||||
ChildrenWithIDs.push_back(std::make_pair(ID, Children[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::sort(ChildrenWithIDs.begin(), ChildrenWithIDs.end());
|
|
||||||
for (unsigned i = 0, e = Children.size(); i != e; ++i)
|
for (unsigned i = 0, e = Children.size(); i != e; ++i)
|
||||||
HoistRegion(ChildrenWithIDs[i].second);
|
HoistRegion(Children[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// canSinkOrHoistInst - Return true if the hoister and sinker can handle this
|
/// canSinkOrHoistInst - Return true if the hoister and sinker can handle this
|
||||||
|
Loading…
x
Reference in New Issue
Block a user