[PATCH] D35105: [SjLj] Replace recursive block marking algorithm with iterative algorithm
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 13:30:24 PDT 2017
MatzeB accepted this revision.
MatzeB added a comment.
This revision is now accepted and ready to land.
Looks good to me. Possible improvement below.
================
Comment at: lib/CodeGen/SjLjEHPrepare.cpp:125-132
if (!LiveBBs.insert(BB).second)
return; // already been here.
- for (BasicBlock *PredBB : predecessors(BB))
- MarkBlocksLiveIn(PredBB, LiveBBs);
+ df_iterator_default_set<BasicBlock*> Visited;
+
+ for (BasicBlock *B : inverse_depth_first_ext(BB, Visited))
+ LiveBBs.insert(B);
----------------
Maybe
```
for (BasicBlock *B : inverse_depth_first_ext(BB, LiveBBs)) {
/* Empty: We want to produce the visited set. */
}
```
works as well? So we can leave out the first if and only need a single set.
https://reviews.llvm.org/D35105
More information about the llvm-commits
mailing list