This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] handle more than two predecessors loop header in ctrloop pass
ClosedPublic

Authored by shchenz on Oct 12 2022, 8:31 PM.

Details

Summary

After ISEL, the "valid" loop header which has two predecessors
(one is preheader and the other one is latch) may be transformed
to have more than two predecessors by some optimizations, like tail
duplicator, if the old header's successor(will be changed to new
header) is a sub loop.

The predecessors of the new loop header are preheader, loop latch
and the loop latch(es) of the sub loop(old header's successor).

Before the patch, ctrloop pass assumes two predecessors for candidate
loop header. This patch fixes this case.

Diff Detail

Event Timeline

shchenz created this revision.Oct 12 2022, 8:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 8:31 PM
shchenz requested review of this revision.Oct 12 2022, 8:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 8:31 PM
shchenz edited the summary of this revision. (Show Details)Oct 12 2022, 8:31 PM

The summary is a bit confusing. Might be phrased to something like
"The header of the outermost loop is also the header of a self-cycle sub loop".

shchenz edited the summary of this revision. (Show Details)Oct 17 2022, 7:27 AM
lkail accepted this revision as: lkail.Oct 17 2022, 7:24 PM

LG.

This revision is now accepted and ready to land.Oct 17 2022, 7:24 PM
shchenz planned changes to this revision.Oct 17 2022, 8:17 PM

This is not a complete solution. I will refine the implementation later.

shchenz updated this revision to Diff 468420.Oct 17 2022, 10:44 PM
shchenz edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Oct 17 2022, 10:44 PM
shchenz edited the summary of this revision. (Show Details)Oct 17 2022, 10:44 PM

Thanks for review and the offline discussion @lkail

shchenz retitled this revision from [PowerPC] handle 3 predecessor loop header in ctrloop pass to [PowerPC] handle more than two predecessors loop header in ctrloop pass.Oct 18 2022, 6:15 PM
shchenz edited the summary of this revision. (Show Details)
shchenz edited the summary of this revision. (Show Details)