This is an archive of the discontinued LLVM Phabricator instance.

[LoopFusion] sink second loop PHIs
ClosedPublic

Authored by caojoshua on Dec 12 2022, 12:05 AM.

Details

Summary

Fixes https://github.com/llvm/llvm-project/issues/59023

PHI nodes that are in the second loop only have the first loop as its
predecessor. These PHI nodes should be sunk to the end of the fused
loop. If the second loop uses the PHI, then the loops cannot be fused.

I don't think this should happen in typical compilation workflows.
The PHI will be in a dedicated exit block of the first loop following
LCSSA transformations.

Diff Detail

Event Timeline

caojoshua created this revision.Dec 12 2022, 12:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 12:05 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
caojoshua published this revision for review.Dec 12 2022, 12:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2022, 12:11 AM
aeubanks accepted this revision.Dec 12 2022, 4:30 PM

not very familiar with the pass, but seems reasonable

This revision is now accepted and ready to land.Dec 12 2022, 4:30 PM

Thanks for the review. I am not a committer. Can I get help merging this? I have the commit in https://github.com/caojoshua/llvm-project/commit/8c5290e665a5e0c9276d6dcc0a1a56e3e23da27c

This revision was landed with ongoing or failed builds.Dec 13 2022, 10:14 AM
Closed by commit rG5004320590ae: [LoopFusion] sink second loop PHIs (authored by caojoshua, committed by aeubanks). · Explain Why
This revision was automatically updated to reflect the committed changes.