Skip to content

Commit

Permalink
[MSSA] Print memory phis when inspecting walker.
Browse files Browse the repository at this point in the history
This makes the MemorySSA and MemorySSA Walker printers consistent.
Invokation `-print<memoryssa-walker>` should also have the MemoryPhis.
  • Loading branch information
alinas committed Apr 6, 2022
1 parent 08075a7 commit 50d41f3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions llvm/lib/Analysis/MemorySSA.cpp
Expand Up @@ -130,6 +130,12 @@ class MemorySSAWalkerAnnotatedWriter : public AssemblyAnnotationWriter {
MemorySSAWalkerAnnotatedWriter(MemorySSA *M)
: MSSA(M), Walker(M->getWalker()) {}

void emitBasicBlockStartAnnot(const BasicBlock *BB,
formatted_raw_ostream &OS) override {
if (MemoryAccess *MA = MSSA->getMemoryAccess(BB))
OS << "; " << *MA << "\n";
}

void emitInstructionAnnot(const Instruction *I,
formatted_raw_ostream &OS) override {
if (MemoryAccess *MA = MSSA->getMemoryAccess(I)) {
Expand Down

0 comments on commit 50d41f3

Please sign in to comment.