[PATCH] D35609: [LICM] Make sinkRegion and hoistRegion non-recursive
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 23:14:57 PDT 2017
sanjoy added inline comments.
================
Comment at: lib/Transforms/Scalar/LICM.cpp:348
+ SmallVector<BasicBlock *, 16> Worklist;
+ DT->getDescendants(N->getBlock(), Worklist);
----------------
`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)`.
https://reviews.llvm.org/D35609
More information about the llvm-commits
mailing list