This is an archive of the discontinued LLVM Phabricator instance.

Add forEachDescendant to DominatorTree.
Needs ReviewPublic

Authored by nicholas on Apr 16 2019, 12:46 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

DominatorTree already has getDescendants, but that always builds up a SmallVector. This is more efficient when the caller doesn't need a vector.

Diff Detail

Event Timeline

nicholas created this revision.Apr 16 2019, 12:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 16 2019, 12:46 AM
kuhar added a comment.Apr 17 2019, 8:46 AM

Would it make sense to use one of the llvm graph iterators and have descendants_begin() and descendants_end() functions instead?

kuhar added a comment.Apr 17 2019, 8:49 AM

OK, I can see that this is exactly what you want to avoid in the related revision. In this case, isn't it possible to provide a dummy storage to DepthFirstIterator and use it to efficiently traverse trees?