From 97f3f7e819ecc0c94190464987b4a685acf607e3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 13 Oct 2003 16:36:06 +0000 Subject: [PATCH] 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 --- lib/Analysis/PostDominators.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index f97fda854e5..2ff5fd331ab 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/lib/Analysis/PostDominators.cpp @@ -51,12 +51,12 @@ bool PostDominatorSet::runOnFunction(Function &F) { do { Changed = false; - std::set Visited; + std::set Visited; DomSetType WorkingSet; for (unsigned i = 0, e = Roots.size(); i != e; ++i) - for (idf_iterator It = idf_begin(Roots[i]), - E = idf_end(Roots[i]); It != E; ++It) { + for (idf_ext_iterator 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?