This is an archive of the discontinued LLVM Phabricator instance.

[MBP] Factor out function hasViableTopFallthrough and enhancement
ClosedPublic

Authored by Carrot on Feb 19 2019, 10:54 AM.

Details

Summary

This patch factor out the function hasViableTopFallthrough from rotateLoop. It is also enhanced. Original code checks only if there is a block can be placed before current loop top. This patch also checks if the loop top is the most possible successor of its predecessor. The attached test case shows its effect.

Diff Detail

Repository
rL LLVM

Event Timeline

Carrot created this revision.Feb 19 2019, 10:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 19 2019, 10:54 AM
davidxl added inline comments.Feb 21 2019, 1:21 PM
lib/CodeGen/MachineBlockPlacement.cpp
2008 ↗(On Diff #187409)

What is the purpose of the check 'Succ == *SuccChain->begin() ?

Carrot marked an inline comment as done.Feb 21 2019, 2:23 PM
Carrot added inline comments.
lib/CodeGen/MachineBlockPlacement.cpp
2008 ↗(On Diff #187409)

!SuccChain means Succ has not been layout in any chain.
'Succ == *SuccChain->begin()' means even Succ has been layout in some chain, the whole chain can still be layout after Pred if it is beneficial.
So (!SuccChain || Succ == *SuccChain->begin()) means it is possible to put Succ after Pred.

davidxl added inline comments.Feb 21 2019, 2:30 PM
lib/CodeGen/MachineBlockPlacement.cpp
2008 ↗(On Diff #187409)

please add a comment there

Carrot updated this revision to Diff 187878.Feb 21 2019, 3:21 PM
Carrot marked an inline comment as done.
davidxl accepted this revision.Feb 21 2019, 3:34 PM

lgtm

This revision is now accepted and ready to land.Feb 21 2019, 3:34 PM
This revision was automatically updated to reflect the committed changes.