[llvm] 813a7f1 - [MemorySSA] Properly handle liveOnEntry in the walker printer
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 2 12:51:52 PDT 2021
Author: Arthur Eubanks
Date: 2021-09-02T12:51:27-07:00
New Revision: 813a7f1ad7b0f2e3df341d03cc8486c3b5927ef1
URL: https://github.com/llvm/llvm-project/commit/813a7f1ad7b0f2e3df341d03cc8486c3b5927ef1
DIFF: https://github.com/llvm/llvm-project/commit/813a7f1ad7b0f2e3df341d03cc8486c3b5927ef1.diff
LOG: [MemorySSA] Properly handle liveOnEntry in the walker printer
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D109177
Added:
Modified:
llvm/lib/Analysis/MemorySSA.cpp
llvm/test/Analysis/MemorySSA/print-walker.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index 06976c444336..b43c45a26094 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -95,6 +95,8 @@ static cl::opt<bool, true>
VerifyMemorySSAX("verify-memoryssa", cl::location(VerifyMemorySSA),
cl::Hidden, cl::desc("Enable verification of MemorySSA."));
+const static char LiveOnEntryStr[] = "liveOnEntry";
+
namespace {
/// An assembly annotator class to print Memory SSA information in
@@ -133,8 +135,13 @@ class MemorySSAWalkerAnnotatedWriter : public AssemblyAnnotationWriter {
if (MemoryAccess *MA = MSSA->getMemoryAccess(I)) {
MemoryAccess *Clobber = Walker->getClobberingMemoryAccess(MA);
OS << "; " << *MA;
- if (Clobber)
- OS << " - clobbered by " << *Clobber;
+ if (Clobber) {
+ OS << " - clobbered by ";
+ if (MSSA->isLiveOnEntryDef(Clobber))
+ OS << LiveOnEntryStr;
+ else
+ OS << *Clobber;
+ }
OS << "\n";
}
}
@@ -2154,8 +2161,6 @@ bool MemorySSA::dominates(const MemoryAccess *Dominator,
return dominates(Dominator, cast<MemoryAccess>(Dominatee.getUser()));
}
-const static char LiveOnEntryStr[] = "liveOnEntry";
-
void MemoryAccess::print(raw_ostream &OS) const {
switch (getValueID()) {
case MemoryPhiVal: return static_cast<const MemoryPhi *>(this)->print(OS);
diff --git a/llvm/test/Analysis/MemorySSA/print-walker.ll b/llvm/test/Analysis/MemorySSA/print-walker.ll
index 5c44b5b2c758..0a8b917b36a5 100644
--- a/llvm/test/Analysis/MemorySSA/print-walker.ll
+++ b/llvm/test/Analysis/MemorySSA/print-walker.ll
@@ -1,15 +1,15 @@
; RUN: opt -passes='print<memoryssa-walker>' -disable-output < %s 2>&1 | FileCheck %s
; CHECK: define void @test
-; CHECK: 1 = MemoryDef(liveOnEntry)->liveOnEntry - clobbered by 0 = MemoryDef(liveOnEntry)
+; CHECK: 1 = MemoryDef(liveOnEntry)->liveOnEntry - clobbered by liveOnEntry
; CHECK: store i8 42, i8* %a1
-; CHECK: 2 = MemoryDef(1)->liveOnEntry - clobbered by 0 = MemoryDef(liveOnEntry)
+; CHECK: 2 = MemoryDef(1)->liveOnEntry - clobbered by liveOnEntry
; CHECK: store i8 42, i8* %a2
; CHECK: MemoryUse(1) MustAlias - clobbered by 1 = MemoryDef(liveOnEntry)->liveOnEntry
; CHECK: %l1 = load i8, i8* %a1
; CHECK: MemoryUse(2) MustAlias - clobbered by 2 = MemoryDef(1)->liveOnEntry
; CHECK: %l2 = load i8, i8* %a2
-; CHECK: 3 = MemoryDef(2)->liveOnEntry - clobbered by 0 = MemoryDef(liveOnEntry)
+; CHECK: 3 = MemoryDef(2)->liveOnEntry - clobbered by liveOnEntry
; CHECK: store i8 42, i8* %p
; CHECK: 4 = MemoryDef(3)->3 MustAlias - clobbered by 3 = MemoryDef(2)->liveOnEntry
; CHECK: store i8 42, i8* %p
More information about the llvm-commits
mailing list