This is an archive of the discontinued LLVM Phabricator instance.

[LoopPredication] Preserve MemorySSA
ClosedPublic

Authored by anna on Aug 25 2021, 1:26 PM.

Details

Summary

Since LICM has now unconditionally moved to MemorySSA based form, all
passes that run in same LPM as LICM need to preserve MemorySSA (i.e. our
downstream pipeline).

Added loop-mssa to all tests and perform -verify-memoryssa within
LoopPredication itself.

Diff Detail

Event Timeline

anna created this revision.Aug 25 2021, 1:26 PM
anna requested review of this revision.Aug 25 2021, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2021, 1:26 PM
nikic added inline comments.Aug 25 2021, 1:48 PM
llvm/lib/Transforms/Scalar/LoopPredication.cpp
329

Should mark MemorySSAWrapperPass as preserved here.

827

There's another RecursivelyDeleteTriviallyDeadInstructions() use in the function below, needs to be adjusted as well?

asbirlea added inline comments.Aug 25 2021, 2:01 PM
llvm/lib/Transforms/Scalar/LoopPredication.cpp
383

This needs to be under the conditional too:

if (AR.MSSA)
  PA.preserve<MemorySSAAnalysis>();
llvm/test/Transforms/LoopPredication/widened.ll
3

Add -verify-memoryssa .

anna marked 4 inline comments as done.Aug 25 2021, 5:38 PM
anna added inline comments.
llvm/lib/Transforms/Scalar/LoopPredication.cpp
383

missed it, thanks.

827

Thank you! good catch.

anna updated this revision to Diff 368787.Aug 25 2021, 5:39 PM
anna marked 2 inline comments as done.

addressed review comments

nikic accepted this revision.Aug 26 2021, 12:10 AM

LGTM. Doesn't look like this pass is doing anything exciting with memory or control flow, so this should be sufficient...

This revision is now accepted and ready to land.Aug 26 2021, 12:10 AM
anna added a comment.Aug 26 2021, 6:52 AM

LGTM. Doesn't look like this pass is doing anything exciting with memory or control flow, so this should be sufficient...

Nothing w.r.t. memory. And control flow - we "widen" an existing check across iterations of a loop. We don't have any DT updates, so I reached the conclusion that there's no MSSA updates needed either.

This revision was automatically updated to reflect the committed changes.