This is an archive of the discontinued LLVM Phabricator instance.

[MemorySSA] Add pass to print results of MemorySSA walker
ClosedPublic

Authored by aeubanks on Aug 31 2021, 2:47 PM.

Diff Detail

Event Timeline

aeubanks created this revision.Aug 31 2021, 2:47 PM
aeubanks requested review of this revision.Aug 31 2021, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2021, 2:47 PM
aeubanks added a subscriber: Prazek.
asbirlea added inline comments.Aug 31 2021, 4:23 PM
llvm/lib/Analysis/MemorySSA.cpp
135

This should print MA if you're just trying to first optimize, then print.

To properly print what the getClobbering returns for invariant groups, you'll need something custom, along the lines:
MA->getID() << " = MemoryDef(" <<MA->getDefiningAccess()->getID()<< "->" Clobber->getID();, and analogous for MemoryUses
See the print approach in lib/Analysis/MemorySSA.cpp:2148, the optimized access needs to be updated to the ones returned by the walker, not the stored one.

happy to bikeshed the exact wording printed

asbirlea accepted this revision.Sep 1 2021, 3:14 PM

The only nit as far as printing is that MA is printed before being optimized, and printing it afterwards (as part of the "clobbered by" section), will make it look different.
For example, in the added test, before: "3 = MemoryDef(2) " and after: "[...] clobbered by 3 = MemoryDef(2)->liveOnEntry".
Not a big deal since this is for informational/debugging purposes only, but if you want to bikeshed... =]

This revision is now accepted and ready to land.Sep 1 2021, 3:14 PM
aeubanks updated this revision to Diff 370084.Sep 1 2021, 3:22 PM

print after calling walker

asbirlea accepted this revision.Sep 1 2021, 3:51 PM

Still LG. Thanks for the update :-)

This revision was landed with ongoing or failed builds.Sep 1 2021, 6:30 PM
This revision was automatically updated to reflect the committed changes.