[PATCH] D35609: [LICM] Make sinkRegion and hoistRegion non-recursive

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 09:41:27 PDT 2017


majnemer added inline comments.


================
Comment at: lib/Transforms/Scalar/LICM.cpp:348
+  SmallVector<BasicBlock *, 16> Worklist;
+  DT->getDescendants(N->getBlock(), Worklist);
 
----------------
sanjoy wrote:
> `getDescendants` seems to be doing a BFS.  Given that (and that DT is a tree), can you iterate `Worklist` in reverse to get a post order?  If you do this, we'd have to spec `getDescendants` as doing a BFS though (and not just have it be an implementation detail).
> 
> OTOH if you write the BFS by hand (instead of relying on `getDescendents`), you can add an early exit for `CurLoop->contains(BB)`.
Do you mean BFS or DFS?


https://reviews.llvm.org/D35609





More information about the llvm-commits mailing list