This is an archive of the discontinued LLVM Phabricator instance.

[BPI][NFC] Unify handling of normal and SCC based loops
ClosedPublic

Authored by ebrevnov on Jul 29 2020, 5:30 AM.

Details

Summary

This is one more NFC part extracted from D79485. Normal and SCC based loops have very different representation and have to be handled separatly each time we deal with loops. D79485 is going to introduce much more extensive use of loops what will be problematic with out this change.

Diff Detail

Event Timeline

ebrevnov created this revision.Jul 29 2020, 5:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2020, 5:30 AM
ebrevnov requested review of this revision.Jul 29 2020, 5:30 AM
davidxl added inline comments.Jul 31 2020, 9:59 AM
llvm/include/llvm/Analysis/BranchProbabilityInfo.h
258

Perhaps make it a class and make related methods below members?

292

perhaps "isLoopCrossingEdge' or isLoopEnteringExitingEdge'?

305

make it a member of the LoopBlock. Also for consistency: getLoopEnteringBlocks.

ebrevnov added inline comments.Aug 4 2020, 1:53 AM
llvm/include/llvm/Analysis/BranchProbabilityInfo.h
258

Similarly to LoopBlock, I'd like to keep it simple and don't populate it with a reference to LoopInfo/SccInfo.

292

I don't like current name either. isLoopEnteringExitingEdge sounds much better for me. Naturally it can be expressed via isLoopEntering/ExitingEdge. Thanks for the suggestion.

305

Moving it to LoopBlock will require keeping a reference to SccInfo from LoopBlock which I'd like to avoid and keep LoopBlock as light wight as possible (similarly, Loop doesn't keep a reference to LoopInfo).

I'm trying to keep same naming convention as we use for exits here. Loop exiting block is a block which belongs to a loop and has an edge to exit block.

ebrevnov updated this revision to Diff 282849.Aug 4 2020, 3:06 AM

Updated according to comments + formatting.

davidxl accepted this revision.Aug 4 2020, 10:32 AM

lgtm

This revision is now accepted and ready to land.Aug 4 2020, 10:32 AM