1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Make use of "external" depth-first iterators to avoid revisiting nodes

multiple times.  This reduces the time to construct post-dominance sets a LOT.
For example, optimizing perlbmk goes from taking 12.9894s to 1.4074s.

llvm-svn: 9091
This commit is contained in:
Chris Lattner 2003-10-13 16:36:06 +00:00
parent 4063621588
commit 97f3f7e819

View File

@ -51,12 +51,12 @@ bool PostDominatorSet::runOnFunction(Function &F) {
do {
Changed = false;
std::set<const BasicBlock*> Visited;
std::set<BasicBlock*> Visited;
DomSetType WorkingSet;
for (unsigned i = 0, e = Roots.size(); i != e; ++i)
for (idf_iterator<BasicBlock*> It = idf_begin(Roots[i]),
E = idf_end(Roots[i]); It != E; ++It) {
for (idf_ext_iterator<BasicBlock*> It = idf_ext_begin(Roots[i], Visited),
E = idf_ext_end(Roots[i], Visited); It != E; ++It) {
BasicBlock *BB = *It;
succ_iterator SI = succ_begin(BB), SE = succ_end(BB);
if (SI != SE) { // Is there SOME successor?