mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Use ETForest instead of DominatorTree.
llvm-svn: 36252
This commit is contained in:
parent
c08636e1f0
commit
c3aa967684
@ -224,14 +224,12 @@ namespace {
|
|||||||
std::map<Value*, unsigned> RankMap;
|
std::map<Value*, unsigned> RankMap;
|
||||||
std::map<BasicBlock*, RegionInfo> RegionInfoMap;
|
std::map<BasicBlock*, RegionInfo> RegionInfoMap;
|
||||||
ETForest *EF;
|
ETForest *EF;
|
||||||
DominatorTree *DT;
|
|
||||||
public:
|
public:
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
|
|
||||||
// We don't modify the program, so we preserve all analyses
|
// We don't modify the program, so we preserve all analyses
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||||
AU.addRequired<ETForest>();
|
AU.addRequired<ETForest>();
|
||||||
AU.addRequired<DominatorTree>();
|
|
||||||
AU.addRequiredID(BreakCriticalEdgesID);
|
AU.addRequiredID(BreakCriticalEdgesID);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -302,7 +300,6 @@ bool CEE::runOnFunction(Function &F) {
|
|||||||
// tree. Note that our traversal will not even touch unreachable basic
|
// tree. Note that our traversal will not even touch unreachable basic
|
||||||
// blocks.
|
// blocks.
|
||||||
EF = &getAnalysis<ETForest>();
|
EF = &getAnalysis<ETForest>();
|
||||||
DT = &getAnalysis<DominatorTree>();
|
|
||||||
|
|
||||||
std::set<BasicBlock*> VisitedBlocks;
|
std::set<BasicBlock*> VisitedBlocks;
|
||||||
bool Changed = TransformRegion(&F.getEntryBlock(), VisitedBlocks);
|
bool Changed = TransformRegion(&F.getEntryBlock(), VisitedBlocks);
|
||||||
@ -349,14 +346,16 @@ bool CEE::TransformRegion(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks){
|
|||||||
// blocks that are dominated by this one, we can safely propagate the
|
// blocks that are dominated by this one, we can safely propagate the
|
||||||
// information down now.
|
// information down now.
|
||||||
//
|
//
|
||||||
DominatorTree::Node *BBN = (*DT)[BB];
|
std::vector<BasicBlock*> children;
|
||||||
if (!RI.empty()) // Time opt: only propagate if we can change something
|
EF->getChildren(BB, children);
|
||||||
for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i) {
|
if (!RI.empty()) { // Time opt: only propagate if we can change something
|
||||||
BasicBlock *Dominated = BBN->getChildren()[i]->getBlock();
|
for (std::vector<BasicBlock*>::iterator CI = children.begin(), E = children.end();
|
||||||
assert(RegionInfoMap.find(Dominated) == RegionInfoMap.end() &&
|
CI != E; ++CI) {
|
||||||
|
assert(RegionInfoMap.find(*CI) == RegionInfoMap.end() &&
|
||||||
"RegionInfo should be calculated in dominanace order!");
|
"RegionInfo should be calculated in dominanace order!");
|
||||||
getRegionInfo(Dominated) = RI;
|
getRegionInfo(*CI) = RI;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now that all of our successors have information if they deserve it,
|
// Now that all of our successors have information if they deserve it,
|
||||||
// propagate any information our terminator instruction finds to our
|
// propagate any information our terminator instruction finds to our
|
||||||
@ -379,8 +378,9 @@ bool CEE::TransformRegion(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now that all of our successors have information, recursively process them.
|
// Now that all of our successors have information, recursively process them.
|
||||||
for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i)
|
for (std::vector<BasicBlock*>::iterator CI = children.begin(), E = children.end();
|
||||||
Changed |= TransformRegion(BBN->getChildren()[i]->getBlock(),VisitedBlocks);
|
CI != E; ++CI)
|
||||||
|
Changed |= TransformRegion(*CI, VisitedBlocks);
|
||||||
|
|
||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user