From ae84e9ab49087a460e74831029d98cb519271a9a Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Thu, 21 Mar 2019 03:11:34 +0000 Subject: [PATCH] [MSSA] Delete move ctor; remove dynamic never-moved verification Code archaeology in D59315 revealed that MSSA should never be moved. Rather than trying to check dynamically that this hasn't happened in the verify() functions of Walkers, it's likely best to just delete its move constructor. Since all these verify() functions did is check that MSSA hasn't moved, this allows us to remove these verify functions. I can readd the verification checks if someone's super concerned about us trying to `memcpy` MemorySSA or something somewhere, but I imagine we have other problems if we're trying anything like that... llvm-svn: 356641 --- llvm/include/llvm/Analysis/MemorySSA.h | 7 +++++-- llvm/lib/Analysis/MemorySSA.cpp | 14 -------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h index fa92fd3..56eb1b2 100644 --- a/llvm/include/llvm/Analysis/MemorySSA.h +++ b/llvm/include/llvm/Analysis/MemorySSA.h @@ -700,6 +700,11 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryPhi, MemoryAccess) class MemorySSA { public: MemorySSA(Function &, AliasAnalysis *, DominatorTree *); + + // MemorySSA must remain where it's constructed; Walkers it creates store + // pointers to it. + MemorySSA(MemorySSA &&) = delete; + ~MemorySSA(); MemorySSAWalker *getWalker(); @@ -1039,8 +1044,6 @@ public: /// the walker it uses or returns. virtual void invalidateInfo(MemoryAccess *) {} - virtual void verify(const MemorySSA *MSSA) { assert(MSSA == this->MSSA); } - protected: friend class MemorySSA; // For updating MSSA pointer in MemorySSA move // constructor. diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 3ad9da9..a1c573a 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -922,8 +922,6 @@ public: #endif return Result; } - - void verify(const MemorySSA *MSSA) { assert(MSSA == &this->MSSA); } }; struct RenamePassData { @@ -963,7 +961,6 @@ public: // additional query becomes heavily used we may decide to cache the result. // Walker instantiations will decide how to set the SkipSelf bool. MemoryAccess *getClobberingMemoryAccessBase(MemoryAccess *, bool); - void verify(const MemorySSA *MSSA) { Walker.verify(MSSA); } }; /// A MemorySSAWalker that does AA walks to disambiguate accesses. It no @@ -987,11 +984,6 @@ public: if (auto *MUD = dyn_cast(MA)) MUD->resetOptimized(); } - - void verify(const MemorySSA *MSSA) override { - MemorySSAWalker::verify(MSSA); - Walker->verify(MSSA); - } }; class MemorySSA::SkipSelfWalker final : public MemorySSAWalker { @@ -1012,11 +1004,6 @@ public: if (auto *MUD = dyn_cast(MA)) MUD->resetOptimized(); } - - void verify(const MemorySSA *MSSA) override { - MemorySSAWalker::verify(MSSA); - Walker->verify(MSSA); - } }; } // end namespace llvm @@ -1775,7 +1762,6 @@ void MemorySSA::verifyMemorySSA() const { verifyDomination(F); verifyOrdering(F); verifyDominationNumbers(F); - Walker->verify(this); // Previously, the verification used to also verify that the clobberingAccess // cached by MemorySSA is the same as the clobberingAccess found at a later // query to AA. This does not hold true in general due to the current fragility -- 2.7.4