From 41df26a4e5685bcdfe3930af7429fea3304908cb Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Wed, 15 Aug 2018 17:34:55 +0000 Subject: [PATCH] [MemorySSA] Expose the verify as a debug option. Summary: Expose VerifyMemorySSA as a debug option. If set, passes will call the MSSA->verifyMemorySSA() after calling into the updater's APIs when MemorySSA should be valid. Reviewers: george.burgess.iv Subscribers: sanjoy, jlebar, Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D50749 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339795 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Debug.h | 4 ++++ lib/Analysis/MemorySSA.cpp | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h index 980abfb0e8d..df86dbb8241 100644 --- a/include/llvm/Support/Debug.h +++ b/include/llvm/Support/Debug.h @@ -94,6 +94,10 @@ extern bool VerifyDomInfo; /// extern bool VerifyLoopInfo; +/// Enables verification of MemorySSA. +/// +extern bool VerifyMemorySSA; + ///\} /// EnableDebugBuffering - This defaults to false. If true, the debug diff --git a/lib/Analysis/MemorySSA.cpp b/lib/Analysis/MemorySSA.cpp index b38c0c4f143..734dee2bcf1 100644 --- a/lib/Analysis/MemorySSA.cpp +++ b/lib/Analysis/MemorySSA.cpp @@ -77,9 +77,15 @@ static cl::opt MaxCheckLimit( cl::desc("The maximum number of stores/phis MemorySSA" "will consider trying to walk past (default = 100)")); -static cl::opt - VerifyMemorySSA("verify-memoryssa", cl::init(false), cl::Hidden, - cl::desc("Verify MemorySSA in legacy printer pass.")); +// Always verify MemorySSA if expensive checking is enabled. +#ifdef EXPENSIVE_CHECKS +bool llvm::VerifyMemorySSA = true; +#else +bool llvm::VerifyMemorySSA = false; +#endif +static cl::opt + VerifyMemorySSAX("verify-memoryssa", cl::location(VerifyMemorySSA), + cl::Hidden, cl::desc("Enable verification of MemorySSA.")); namespace llvm {