From 932b4cbf5d4b629c2796aeb9460b988a555a85e0 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Wed, 10 Feb 2016 17:39:43 +0000 Subject: Constify two functions, make them accessible to unit tests llvm-svn: 260387 --- llvm/lib/Transforms/Utils/MemorySSA.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Transforms/Utils/MemorySSA.cpp') diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp index 54133f0df93..faa25b5ade8 100644 --- a/llvm/lib/Transforms/Utils/MemorySSA.cpp +++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp @@ -439,9 +439,14 @@ void MemorySSA::dump() const { F.print(dbgs(), &Writer); } +void MemorySSA::verifyMemorySSA() const { + verifyDefUses(F); + verifyDomination(F); +} + /// \brief Verify the domination properties of MemorySSA by checking that each /// definition dominates all of its uses. -void MemorySSA::verifyDomination(Function &F) { +void MemorySSA::verifyDomination(Function &F) const { for (BasicBlock &B : F) { // Phi nodes are attached to basic blocks if (MemoryPhi *MP = getMemoryAccess(&B)) { @@ -496,7 +501,7 @@ void MemorySSA::verifyDomination(Function &F) { /// llvm_unreachable is used instead of asserts because this may be called in /// a build without asserts. In that case, we don't want this to turn into a /// nop. -void MemorySSA::verifyUseInDefs(MemoryAccess *Def, MemoryAccess *Use) { +void MemorySSA::verifyUseInDefs(MemoryAccess *Def, MemoryAccess *Use) const { // The live on entry use may cause us to get a NULL def here if (!Def) { if (!isLiveOnEntryDef(Use)) @@ -510,7 +515,7 @@ void MemorySSA::verifyUseInDefs(MemoryAccess *Def, MemoryAccess *Use) { /// \brief Verify the immediate use information, by walking all the memory /// accesses and verifying that, for each use, it appears in the /// appropriate def's use list -void MemorySSA::verifyDefUses(Function &F) { +void MemorySSA::verifyDefUses(Function &F) const { for (BasicBlock &B : F) { // Phi nodes are attached to basic blocks if (MemoryPhi *Phi = getMemoryAccess(&B)) @@ -655,8 +660,7 @@ bool MemorySSAPrinterPass::runOnFunction(Function &F) { Walker.reset(MSSA->buildMemorySSA(AA, DT)); if (VerifyMemorySSA) { - MSSA->verifyDefUses(F); - MSSA->verifyDomination(F); + MSSA->verifyMemorySSA(); } return false; -- cgit v1.2.3