This is an archive of the discontinued LLVM Phabricator instance.

[LoopInfo] Introduce getUniqueNonLatchExitBlocks utility function
ClosedPublic

Authored by skatkov on Jul 11 2019, 12:42 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

skatkov created this revision.Jul 11 2019, 12:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2019, 12:42 AM
reames accepted this revision.Jul 12 2019, 10:09 AM

LGTM

This revision is now accepted and ready to land.Jul 12 2019, 10:09 AM
fhahn added a subscriber: fhahn.Jul 12 2019, 11:10 AM

IMO this seems like quite a specific function to add (there are other blocks that might be interesting to filter ). I think we could achieve the same thing with a filter_range on the caller side without much extra code and with it being slightly more explicit. But that’s quite subjective, so feel free to disregard.

Regarding tests, I think we have unit tests for most functions in LoopInfo, it would be good to add a test there for the new function too, if you decide to add it

skatkov updated this revision to Diff 209756.Jul 14 2019, 8:57 PM

Make getUniqueExitBlocksHelper more general with using filter predicate.
Unit test is added.

I decided to avoid using public API with predicate due to it will require introducing template function in template class and effectively moving implementation to LoopInfo.h

The explicit function for explicit need seems to be fine to me. If someone needs to introduce new function or move this to public API all building blocks are in place.

This revision was automatically updated to reflect the committed changes.