This is an archive of the discontinued LLVM Phabricator instance.

[LoopRotate] Get and update MSSA only if available in legacy pass manager.
ClosedPublic

Authored by asbirlea on Feb 13 2020, 11:47 AM.

Details

Summary

Potential fix for: https://bugs.llvm.org/show_bug.cgi?id=44889 and https://bugs.llvm.org/show_bug.cgi?id=44408

In the legacy pass manager, loop rotate need not compute MemorySSA when not being in the same loop pass manager with other loop passes.
There isn't currently a way to differentiate between the two cases, so this attempts to limit the usage in LoopRotate to only update MemorySSA when the analysis is already available.
The side-effect of this is that it will split the Loop pipeline.

This issue does not apply to the new pass manager, where we have a flag specifying if all loop passes in that loop pass manager preserve MemorySSA.

Diff Detail

Event Timeline

asbirlea created this revision.Feb 13 2020, 11:47 AM
dmgreen accepted this revision.Feb 14 2020, 12:58 AM

Sounds like a good idea to me.

This revision is now accepted and ready to land.Feb 14 2020, 12:58 AM
fhahn added a subscriber: fhahn.Feb 14 2020, 2:54 AM

This workaround seems fine. I don't think there should be much interaction between LoopRotate and LICM/LoopUnswitch and running LoopRotate on all loops first should not really pessimism optimisations.

llvm/lib/Transforms/Scalar/LoopRotation.cpp
84

I think it would be good to add a comment that this will split the loop pipeline, to delay computing MemorySSA/skipping relatively costly updates?

This revision was automatically updated to reflect the committed changes.
asbirlea marked an inline comment as done.