Page MenuHomePhabricator

[LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it.

Authored by asbirlea on Aug 16 2019, 5:48 PM.



Add a flag to the FunctionToLoopAdaptor that allows enabling MemorySSA only for the loop pass managers that are known to preserve it.

If an LPM is known to have only loop transforms that *all* preserve MemorySSA, then use MemorySSA if EnableMSSALoopDependency is set.
If an LPM has loop passes that do not preserve MemorySSA, then the flag passed is false, regardless of the value of EnableMSSALoopDependency.

When using a custom loop pass pipeline via passes=..., use keyword loop vs loop-mssa to use MemorySSA in that LPM. If a loop that does not preserve MemorySSA is added while using the loop-mssa keyword, that's an error.

Add the new loop-mssa keyword to a few tests where a difference occurs when enabling MemorySSA.

Diff Detail


Event Timeline

asbirlea created this revision.Aug 16 2019, 5:48 PM
chandlerc accepted this revision.Aug 20 2019, 4:12 PM

Some nits below. LGTM with those fixed!

117 ↗(On Diff #215725)

self is MSSA -> self if MSSA.

316 ↗(On Diff #215725)

I would cache the result of AM.getResult<LoopAnalysisManagerFunctionProxy>(F) in a variable -- it's cheap but not free to lookup.

484 ↗(On Diff #215725)

Maybe comment explaining that the second LPM does unrolling and so doesn't preserve MemorySSA?

2002 ↗(On Diff #215725)

Maybe: = (Name == "loop-mssa");?

This revision is now accepted and ready to land.Aug 20 2019, 4:12 PM
asbirlea updated this revision to Diff 216287.Aug 20 2019, 4:32 PM
asbirlea marked 4 inline comments as done.

Address comments.

This revision was automatically updated to reflect the committed changes.