This is an archive of the discontinued LLVM Phabricator instance.

[GVN LoadPRE] Add an option to disable splitting backedge
ClosedPublic

Authored by skatkov on Oct 20 2020, 11:52 PM.

Details

Summary

GVN Load PRE can split the backedge causing breaking the loop structure where the latch
contains the conditional branch with for example induction variable.

Different optimizations expect this form of the loop, so it is better to preserve it for some time.
This CL adds an option to control an ability to split backedge.

Default value is true so technically it is NFC and current behavior is not changed.

Diff Detail

Event Timeline

skatkov created this revision.Oct 20 2020, 11:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2020, 11:52 PM
skatkov requested review of this revision.Oct 20 2020, 11:52 PM
fhahn added a comment.Oct 21 2020, 6:07 AM

This seems reasonable. Do you plan to use this option in the default pipeline/do you think there are any benefits for the regular pipeline?

llvm/test/Transforms/GVN/PRE/load-pre-split-backedge.ll
7

nit: do we need the triple?

skatkov updated this revision to Diff 299855.Oct 21 2020, 9:16 PM

handled nit

This seems reasonable. Do you plan to use this option in the default pipeline/do you think there are any benefits for the regular pipeline?

Hi Florian, to be honest I have no idea of the impact on default pipeline. I know that GVN Load PRE negatively impacts peeling, loop predication, so the passes expecting that latch has a conditional branch.
So I do not plan to update the default pipeline but if there is a volunteer to play with default pipeline, all tools will be there.

Fine by me, but please wait some time in case anyone has cons.

Fine by me, but please wait some time in case anyone has cons.

No new cons for 4 days, so consider your comment as an approve.
Anyway we can fix any cons as follow-ups.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 26 2020, 10:32 PM
This revision was automatically updated to reflect the committed changes.