This is an archive of the discontinued LLVM Phabricator instance.

[LoopInterchange] Preserve LCSSA.
ClosedPublic

Authored by fhahn on Sep 16 2018, 1:18 PM.

Details

Summary

This patch extends LoopInterchange to move LCSSA to the right place
after interchanging. This is required for LoopInterchange to become a
function pass.

An alternative to the manual moving of the PHIs, we could also re-form
the LCSSA phis for a set of interchanged loops, but that's more
expensive.

Diff Detail

Repository
rL LLVM

Event Timeline

Please fix the testcases so the input is in LCSSA form. (The opt invocation will automatically fix the input if necessary, but it's confusing.)

lib/Transforms/Scalar/LoopInterchange.cpp
1354 ↗(On Diff #165692)

cast<>: every user of an Instruction is also an Instruction.

fhahn updated this revision to Diff 167171.Sep 26 2018, 12:04 PM

Updated tests to be in lcssa form where applicable. I used the output from opt -lcssa, which also added the predecessors. I think that's helpful, but I can also strip out those changes

fhahn marked an inline comment as done.Sep 26 2018, 12:04 PM
efriedma accepted this revision.Sep 26 2018, 12:12 PM

LGTM

lib/Transforms/Scalar/LoopInterchange.cpp
1355 ↗(On Diff #167171)

Usr is always non-null.

This revision is now accepted and ready to land.Sep 26 2018, 12:12 PM
This revision was automatically updated to reflect the committed changes.
fhahn marked an inline comment as done.Sep 26 2018, 12:39 PM

Thanks Eli!