From: Philip Pfaffe Date: Tue, 8 Jan 2019 14:06:58 +0000 (+0000) Subject: [DA][NewPM] Add a printerpass and port the testsuite X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7b7319bc2a6f4b8bad2e488609962b01a3fa544;p=llvm [DA][NewPM] Add a printerpass and port the testsuite The new-pm version of DA is untested. Testing requires a printer, so add that and use it in the existing DA tests. Differential Revision: https://reviews.llvm.org/D56386 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350624 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/DependenceAnalysis.h b/include/llvm/Analysis/DependenceAnalysis.h index c8ec737a2cb..69d0e2c1513 100644 --- a/include/llvm/Analysis/DependenceAnalysis.h +++ b/include/llvm/Analysis/DependenceAnalysis.h @@ -936,6 +936,17 @@ template class ArrayRef; friend struct AnalysisInfoMixin; }; // class DependenceAnalysis + /// Printer pass to dump DA results. + struct DependenceAnalysisPrinterPass + : public PassInfoMixin { + DependenceAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {} + + PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM); + + private: + raw_ostream &OS; + }; // class DependenceAnalysisPrinterPass + /// Legacy pass manager pass to access dependence information class DependenceAnalysisWrapperPass : public FunctionPass { public: diff --git a/lib/Analysis/DependenceAnalysis.cpp b/lib/Analysis/DependenceAnalysis.cpp index b544ae5f535..3f4dfa52e1d 100644 --- a/lib/Analysis/DependenceAnalysis.cpp +++ b/lib/Analysis/DependenceAnalysis.cpp @@ -194,6 +194,13 @@ void DependenceAnalysisWrapperPass::print(raw_ostream &OS, dumpExampleDependence(OS, info.get()); } +PreservedAnalyses +DependenceAnalysisPrinterPass::run(Function &F, FunctionAnalysisManager &FAM) { + OS << "'Dependence Analysis' for function '" << F.getName() << "':\n"; + dumpExampleDependence(OS, &FAM.getResult(F)); + return PreservedAnalyses::all(); +} + //===----------------------------------------------------------------------===// // Dependence methods diff --git a/lib/Passes/PassRegistry.def b/lib/Passes/PassRegistry.def index f20b597a8f0..a8c03ad0596 100644 --- a/lib/Passes/PassRegistry.def +++ b/lib/Passes/PassRegistry.def @@ -201,6 +201,7 @@ FUNCTION_PASS("print", PrintFunctionPass(dbgs())) FUNCTION_PASS("print", AssumptionPrinterPass(dbgs())) FUNCTION_PASS("print", BlockFrequencyPrinterPass(dbgs())) FUNCTION_PASS("print", BranchProbabilityPrinterPass(dbgs())) +FUNCTION_PASS("print", DependenceAnalysisPrinterPass(dbgs())) FUNCTION_PASS("print", DominatorTreePrinterPass(dbgs())) FUNCTION_PASS("print", PostDominatorTreePrinterPass(dbgs())) FUNCTION_PASS("print", DemandedBitsPrinterPass(dbgs())) diff --git a/test/Analysis/DependenceAnalysis/AA.ll b/test/Analysis/DependenceAnalysis/AA.ll index 0d213e25e13..6f9c828798c 100644 --- a/test/Analysis/DependenceAnalysis/AA.ll +++ b/test/Analysis/DependenceAnalysis/AA.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" \ +; RUN: "-aa-pipeline=basic-aa,type-based-aa" 2>&1 | FileCheck %s ; RUN: opt < %s -analyze -basicaa -tbaa -da | FileCheck %s ; CHECK-LABEL: 'Dependence Analysis' for function 'test_no_noalias' diff --git a/test/Analysis/DependenceAnalysis/Banerjee.ll b/test/Analysis/DependenceAnalysis/Banerjee.ll index 8c28231164e..5dda3a9030f 100644 --- a/test/Analysis/DependenceAnalysis/Banerjee.ll +++ b/test/Analysis/DependenceAnalysis/Banerjee.ll @@ -1,4 +1,8 @@ +; RUN: opt < %s -disable-output -da-delinearize=false "-passes=print" \ +; RUN: -aa-pipeline=basic-aa 2>&1 | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da -da-delinearize=false | FileCheck %s +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s -check-prefix=DELIN ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s -check-prefix=DELIN target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/BasePtrBug.ll b/test/Analysis/DependenceAnalysis/BasePtrBug.ll index 8de75df7dbd..694e26afa09 100644 --- a/test/Analysis/DependenceAnalysis/BasePtrBug.ll +++ b/test/Analysis/DependenceAnalysis/BasePtrBug.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; Test that the dependence analysis generates the correct results when using diff --git a/test/Analysis/DependenceAnalysis/Constraints.ll b/test/Analysis/DependenceAnalysis/Constraints.ll index 42dfac767a7..2fbee702e8e 100644 --- a/test/Analysis/DependenceAnalysis/Constraints.ll +++ b/test/Analysis/DependenceAnalysis/Constraints.ll @@ -1,3 +1,4 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 ; RUN: opt < %s -analyze -basicaa -da ;; Check that this code doesn't abort. Test case is reduced version of lnt Polybench benchmark test case dynprog. diff --git a/test/Analysis/DependenceAnalysis/Coupled.ll b/test/Analysis/DependenceAnalysis/Coupled.ll index 709567105ba..0480087145b 100644 --- a/test/Analysis/DependenceAnalysis/Coupled.ll +++ b/test/Analysis/DependenceAnalysis/Coupled.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/DADelin.ll b/test/Analysis/DependenceAnalysis/DADelin.ll index 8438c2bf425..5c706240685 100644 --- a/test/Analysis/DependenceAnalysis/DADelin.ll +++ b/test/Analysis/DependenceAnalysis/DADelin.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" diff --git a/test/Analysis/DependenceAnalysis/ExactRDIV.ll b/test/Analysis/DependenceAnalysis/ExactRDIV.ll index 5b2488c1bc8..44b399cb191 100644 --- a/test/Analysis/DependenceAnalysis/ExactRDIV.ll +++ b/test/Analysis/DependenceAnalysis/ExactRDIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; ModuleID = 'ExactRDIV.bc' diff --git a/test/Analysis/DependenceAnalysis/ExactSIV.ll b/test/Analysis/DependenceAnalysis/ExactSIV.ll index e815799fa99..f3fba8258bd 100644 --- a/test/Analysis/DependenceAnalysis/ExactSIV.ll +++ b/test/Analysis/DependenceAnalysis/ExactSIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/GCD.ll b/test/Analysis/DependenceAnalysis/GCD.ll index b0fcda4a6d5..5f734b70f5c 100644 --- a/test/Analysis/DependenceAnalysis/GCD.ll +++ b/test/Analysis/DependenceAnalysis/GCD.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s -check-prefix=DELIN ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s -check-prefix=DELIN target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/Invariant.ll b/test/Analysis/DependenceAnalysis/Invariant.ll index c96412771bb..6835582ac4c 100644 --- a/test/Analysis/DependenceAnalysis/Invariant.ll +++ b/test/Analysis/DependenceAnalysis/Invariant.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; Test for a bug, which caused an assert when an invalid diff --git a/test/Analysis/DependenceAnalysis/MIVCheckConst.ll b/test/Analysis/DependenceAnalysis/MIVCheckConst.ll index 64e72df55b8..d5dd1050b19 100644 --- a/test/Analysis/DependenceAnalysis/MIVCheckConst.ll +++ b/test/Analysis/DependenceAnalysis/MIVCheckConst.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -analyze -basicaa -da +; RUN: opt < %s -passes="print" ; Test that the dependence analysis pass does seg-fault due to a null pointer ; dereference. The code in gcdMIVTest requires a null check for the result of diff --git a/test/Analysis/DependenceAnalysis/NonAffineExpr.ll b/test/Analysis/DependenceAnalysis/NonAffineExpr.ll index f12e20f336a..801b3f6dd6f 100644 --- a/test/Analysis/DependenceAnalysis/NonAffineExpr.ll +++ b/test/Analysis/DependenceAnalysis/NonAffineExpr.ll @@ -1,3 +1,4 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 ; RUN: opt < %s -analyze -basicaa -da ; ; CHECK: da analyze - consistent input [S S]! diff --git a/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll b/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll index afeb061eb5e..3e2ef436784 100644 --- a/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll +++ b/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s -check-prefix=DELIN ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s -check-prefix=DELIN target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/PR21585.ll b/test/Analysis/DependenceAnalysis/PR21585.ll index 23af449ad51..ff42ba96b23 100644 --- a/test/Analysis/DependenceAnalysis/PR21585.ll +++ b/test/Analysis/DependenceAnalysis/PR21585.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" \ +; RUN: "-aa-pipeline=basic-aa,globals-aa" 2>&1 | FileCheck %s ; RUN: opt < %s -analyze -basicaa -globals-aa -da | FileCheck %s define void @i32_subscript(i32* %a) { entry: diff --git a/test/Analysis/DependenceAnalysis/Preliminary.ll b/test/Analysis/DependenceAnalysis/Preliminary.ll index 372d78a1acd..2c7e5dd0db3 100644 --- a/test/Analysis/DependenceAnalysis/Preliminary.ll +++ b/test/Analysis/DependenceAnalysis/Preliminary.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/Propagating.ll b/test/Analysis/DependenceAnalysis/Propagating.ll index 0aa2567c996..64d6a9cfae0 100644 --- a/test/Analysis/DependenceAnalysis/Propagating.ll +++ b/test/Analysis/DependenceAnalysis/Propagating.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/Separability.ll b/test/Analysis/DependenceAnalysis/Separability.ll index 8e6c775fedb..b6004b8d5ee 100644 --- a/test/Analysis/DependenceAnalysis/Separability.ll +++ b/test/Analysis/DependenceAnalysis/Separability.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/StrongSIV.ll b/test/Analysis/DependenceAnalysis/StrongSIV.ll index 4a6136e9826..f7528a52316 100644 --- a/test/Analysis/DependenceAnalysis/StrongSIV.ll +++ b/test/Analysis/DependenceAnalysis/StrongSIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll b/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll index 6e8b98ca264..34c1415aeb5 100644 --- a/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll +++ b/test/Analysis/DependenceAnalysis/SymbolicRDIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; ModuleID = 'SymbolicRDIV.bc' diff --git a/test/Analysis/DependenceAnalysis/SymbolicSIV.ll b/test/Analysis/DependenceAnalysis/SymbolicSIV.ll index 26c4770907b..b24547f7380 100644 --- a/test/Analysis/DependenceAnalysis/SymbolicSIV.ll +++ b/test/Analysis/DependenceAnalysis/SymbolicSIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/UsefulGEP.ll b/test/Analysis/DependenceAnalysis/UsefulGEP.ll index cd46a275034..283fd2ce2e7 100644 --- a/test/Analysis/DependenceAnalysis/UsefulGEP.ll +++ b/test/Analysis/DependenceAnalysis/UsefulGEP.ll @@ -1,3 +1,4 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 ; RUN: opt < %s -analyze -basicaa -da ;; Check this doesn't crash. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll b/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll index 5b81ec10f9d..119ae98bb53 100644 --- a/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll +++ b/test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; ModuleID = 'WeakCrossingSIV.bc' diff --git a/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll b/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll index 128eb47018a..37c912ca716 100644 --- a/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll +++ b/test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; ModuleID = 'WeakZeroDstSIV.bc' diff --git a/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll b/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll index 43c3de16935..602a79194e9 100644 --- a/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll +++ b/test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; ModuleID = 'WeakZeroSrcSIV.bc' diff --git a/test/Analysis/DependenceAnalysis/ZIV.ll b/test/Analysis/DependenceAnalysis/ZIV.ll index b3216415c8e..c2049a62977 100644 --- a/test/Analysis/DependenceAnalysis/ZIV.ll +++ b/test/Analysis/DependenceAnalysis/ZIV.ll @@ -1,3 +1,5 @@ +; RUN: opt < %s -disable-output "-passes=print" -aa-pipeline=basic-aa 2>&1 \ +; RUN: | FileCheck %s ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s ; ModuleID = 'ZIV.bc'