From aa283d80fe7aaa9460e510f20a732f9fbff69ac4 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Thu, 14 Jun 2018 19:55:53 +0000 Subject: [MSSA] Print more optimization information In particular, when asked to print a MemoryAccess, we'll now print where defs are optimized to, and we'll print optimized access types. This patch also introduces an operator<< to make printing AliasResults easier. Patch by Juneyoung Lee! Differential Revision: https://reviews.llvm.org/D47860 llvm-svn: 334760 --- llvm/lib/Analysis/MemorySSA.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Analysis/MemorySSA.cpp') diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 43fc7d40d78..dda42274fdc 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -1857,12 +1857,24 @@ void MemoryAccess::print(raw_ostream &OS) const { void MemoryDef::print(raw_ostream &OS) const { MemoryAccess *UO = getDefiningAccess(); + auto printID = [&OS](MemoryAccess *A) { + if (A && A->getID()) + OS << A->getID(); + else + OS << LiveOnEntryStr; + }; + OS << getID() << " = MemoryDef("; - if (UO && UO->getID()) - OS << UO->getID(); - else - OS << LiveOnEntryStr; - OS << ')'; + printID(UO); + OS << ")"; + + if (isOptimized()) { + OS << "->"; + printID(getOptimized()); + + if (Optional AR = getOptimizedAccessType()) + OS << " " << *AR; + } } void MemoryPhi::print(raw_ostream &OS) const { @@ -1899,6 +1911,9 @@ void MemoryUse::print(raw_ostream &OS) const { else OS << LiveOnEntryStr; OS << ')'; + + if (Optional AR = getOptimizedAccessType()) + OS << " " << *AR; } void MemoryAccess::dump() const { -- cgit v1.2.3