[PATCH] Replace loop doing postorder walk with postorder iterator
Daniel Berlin
dberlin at dberlin.org
Wed Apr 15 17:12:17 PDT 2015
Will do!
On Wed, Apr 15, 2015 at 5:10 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> Looks good with a tiny nit fixed below.
>
>
> ================
> Comment at: include/llvm/Analysis/LoopInfoImpl.h:425
> @@ -435,18 +424,3 @@
> void PopulateLoopsDFS<BlockT, LoopT>::traverse(BlockT *EntryBlock) {
> - pushBlock(EntryBlock);
> - VisitedBlocks.insert(EntryBlock);
> - while (!DFSStack.empty()) {
> - // Traverse the leftmost path as far as possible.
> - while (dfsSucc() != dfsSuccEnd()) {
> - BlockT *BB = *dfsSucc();
> - ++dfsSucc();
> - if (!VisitedBlocks.insert(BB).second)
> - continue;
> -
> - // Push the next DFS successor onto the stack.
> - pushBlock(BB);
> - }
> - // Visit the top of the stack in postorder and backtrack.
> - insertIntoLoop(dfsSource());
> - DFSStack.pop_back();
> - }
> + for (auto BB : post_order(EntryBlock))
> + insertIntoLoop(BB);
> ----------------
> Especially here, where post_order could return anything, I'd write out explicitly "for (BlockT *BB : ...)".
>
> http://reviews.llvm.org/D9032
>
> EMAIL PREFERENCES
> http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
More information about the llvm-commits
mailing list