Page MenuHomePhabricator

[MBP] Make sure the exit BB is the most possible successor before rotating a loop
Needs ReviewPublic

Authored by Carrot on Mar 8 2019, 1:39 PM.

Details

Reviewers
davidxl
Summary

In findBestLoopExit it only finds a BB that can exit a loop, but it doesn't consider the exit BB may have other better predecessor. In that case the exit BB is placed after other predecessor, rotation actually makes loop layout worse.

Diff Detail

Event Timeline

Carrot created this revision.Mar 8 2019, 1:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2019, 1:39 PM
davidxl added inline comments.Mar 11 2019, 8:11 PM
lib/CodeGen/MachineBlockPlacement.cpp
1871

loop rotation can save one internal fall through, not just adding a loop exit fall through. Do you need to consider the overall cost/savings?

Carrot marked an inline comment as done.Mar 19 2019, 1:20 PM
Carrot added inline comments.
lib/CodeGen/MachineBlockPlacement.cpp
1871

If MBB is not the best predecessor of Succ, then Succ will not be placed after MBB, the overall cost saving should not consider MBB -> Succ.