This is an archive of the discontinued LLVM Phabricator instance.

[GVN] Enable enable-split-backedge-in-load-pre option by default
ClosedPublic

Authored by nikic on May 25 2022, 7:55 AM.

Details

Summary

This option was added in D89854. It prevents GVN from performing load PRE in a loop if doing so would require critical edge splitting on the backedge. From the review:

I know that GVN Load PRE negatively impacts peeling, loop predication, so the passes expecting that latch has a conditional branch.

In the PhaseOrdering test in this patch, splitting the backedge negatively affects vectorization: After critical edge splitting, the loop gets rotated, effectively peeling off the first loop iteration. The effect is that the first element is handled separately, then the bulk of the elements use a vectorized reduction (but using unaligned, off-by-one memory accesses) and then a tail of 15 elements is handled separately again.

It's probably worth noting that the loop load PRE from D99926 is not affected by this change (as it does not need backedge splitting). This is about normal load PRE that happens to occur inside a loop.

Diff Detail

Event Timeline

nikic created this revision.May 25 2022, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 7:55 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic requested review of this revision.May 25 2022, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 7:55 AM
reames accepted this revision.May 25 2022, 8:04 AM

LGTM

Yeah, splitting backedges out of canonical form is questionable. I honestly thing we should be better about handling the split form, but the reality is we're not, and thus this is entirely reasonable in practice.

This revision is now accepted and ready to land.May 25 2022, 8:04 AM
This revision was landed with ongoing or failed builds.May 30 2022, 12:56 AM
This revision was automatically updated to reflect the committed changes.

This exposed a failure on our (Linaro's) test suite bot for Armv7. I've opened an issue for it: https://github.com/llvm/llvm-project/issues/55899