[MemorySSA] Reinstate the legacy printer and verifier.
Differential Revision: http://reviews.llvm.org/D22058 llvm-svn: 274679
This commit is contained in:
parent
a29971faeb
commit
232e29ebea
|
@ -226,6 +226,7 @@ void initializeMemDepPrinterPass(PassRegistry&);
|
|||
void initializeMemDerefPrinterPass(PassRegistry&);
|
||||
void initializeMemoryDependenceWrapperPassPass(PassRegistry&);
|
||||
void initializeMemorySSAWrapperPassPass(PassRegistry&);
|
||||
void initializeMemorySSAPrinterLegacyPassPass(PassRegistry &);
|
||||
void initializeMemorySanitizerPass(PassRegistry&);
|
||||
void initializeMergeFunctionsPass(PassRegistry&);
|
||||
void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry &);
|
||||
|
|
|
@ -626,6 +626,17 @@ private:
|
|||
unsigned NextID;
|
||||
};
|
||||
|
||||
// This pass does eager building and then printing of MemorySSA. It is used by
|
||||
// the tests to be able to build, dump, and verify Memory SSA.
|
||||
class MemorySSAPrinterLegacyPass : public FunctionPass {
|
||||
public:
|
||||
MemorySSAPrinterLegacyPass();
|
||||
|
||||
static char ID;
|
||||
bool runOnFunction(Function &) override;
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
};
|
||||
|
||||
/// An analysis that produces \c MemorySSA for a function.
|
||||
///
|
||||
class MemorySSAAnalysis : public AnalysisInfoMixin<MemorySSAAnalysis> {
|
||||
|
|
|
@ -54,6 +54,16 @@ INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
|
|||
INITIALIZE_PASS_END(MemorySSAWrapperPass, "memoryssa", "Memory SSA", false,
|
||||
true)
|
||||
|
||||
INITIALIZE_PASS_BEGIN(MemorySSAPrinterLegacyPass, "print-memoryssa",
|
||||
"Memory SSA Printer", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
|
||||
INITIALIZE_PASS_END(MemorySSAPrinterLegacyPass, "print-memoryssa",
|
||||
"Memory SSA Printer", false, false)
|
||||
|
||||
static cl::opt<bool>
|
||||
VerifyMemorySSA("verify-memoryssa", cl::init(false), cl::Hidden,
|
||||
cl::desc("Verify MemorySSA in legacy printer pass."));
|
||||
|
||||
namespace llvm {
|
||||
/// \brief An assembly annotator class to print Memory SSA information in
|
||||
/// comments.
|
||||
|
@ -894,6 +904,26 @@ void MemoryAccess::dump() const {
|
|||
dbgs() << "\n";
|
||||
}
|
||||
|
||||
char MemorySSAPrinterLegacyPass::ID = 0;
|
||||
|
||||
MemorySSAPrinterLegacyPass::MemorySSAPrinterLegacyPass() : FunctionPass(ID) {
|
||||
initializeMemorySSAPrinterLegacyPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
void MemorySSAPrinterLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<MemorySSAWrapperPass>();
|
||||
AU.addPreserved<MemorySSAWrapperPass>();
|
||||
}
|
||||
|
||||
bool MemorySSAPrinterLegacyPass::runOnFunction(Function &F) {
|
||||
auto &MSSA = getAnalysis<MemorySSAWrapperPass>().getMSSA();
|
||||
MSSA.print(dbgs());
|
||||
if (VerifyMemorySSA)
|
||||
MSSA.verifyMemorySSA();
|
||||
return false;
|
||||
}
|
||||
|
||||
char MemorySSAAnalysis::PassID;
|
||||
|
||||
MemorySSA MemorySSAAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
|
||||
|
|
|
@ -34,6 +34,7 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) {
|
|||
initializeInstSimplifierPass(Registry);
|
||||
initializeMetaRenamerPass(Registry);
|
||||
initializeMemorySSAWrapperPassPass(Registry);
|
||||
initializeMemorySSAPrinterLegacyPassPass(Registry);
|
||||
}
|
||||
|
||||
/// LLVMInitializeTransformUtils - C binding for initializeTransformUtilsPasses.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Ensures that atomic loads count as MemoryDefs
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
%struct.hoge = type { i32, %struct.widget }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Ensuring that external functions without attributes are MemoryDefs
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Test that various function attributes give us sane results.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
define void @F(i8*) {
|
||||
br i1 true, label %left, label %right
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; XFAIL: *
|
||||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>' -verify-memoryssa -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Invariant loads should be considered live on entry, because, once the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; many-dom.ll, with an added back-edge back into the switch.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Testing many dominators, specifically from a switch statement in C.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Makes sure we have a sane model if both successors of some block is the same
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; hfinkel's case
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Checks that basicAA is doing some amount of disambiguation for us
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; This test ensures we don't end up with multiple reaching defs for a single
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; Function Attrs: ssp uwtable
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; %ptr can't alias %local, so we should be able to optimize the use of %local to
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: opt -basicaa -memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s
|
||||
;
|
||||
; Ensures that volatile stores/loads count as MemoryDefs
|
||||
|
|
Loading…
Reference in New Issue