]> granicus.if.org Git - llvm/commitdiff
[DA][NewPM] Add a printerpass and port the testsuite
authorPhilip Pfaffe <philip.pfaffe@gmail.com>
Tue, 8 Jan 2019 14:06:58 +0000 (14:06 +0000)
committerPhilip Pfaffe <philip.pfaffe@gmail.com>
Tue, 8 Jan 2019 14:06:58 +0000 (14:06 +0000)
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

28 files changed:
include/llvm/Analysis/DependenceAnalysis.h
lib/Analysis/DependenceAnalysis.cpp
lib/Passes/PassRegistry.def
test/Analysis/DependenceAnalysis/AA.ll
test/Analysis/DependenceAnalysis/Banerjee.ll
test/Analysis/DependenceAnalysis/BasePtrBug.ll
test/Analysis/DependenceAnalysis/Constraints.ll
test/Analysis/DependenceAnalysis/Coupled.ll
test/Analysis/DependenceAnalysis/DADelin.ll
test/Analysis/DependenceAnalysis/ExactRDIV.ll
test/Analysis/DependenceAnalysis/ExactSIV.ll
test/Analysis/DependenceAnalysis/GCD.ll
test/Analysis/DependenceAnalysis/Invariant.ll
test/Analysis/DependenceAnalysis/MIVCheckConst.ll
test/Analysis/DependenceAnalysis/NonAffineExpr.ll
test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll
test/Analysis/DependenceAnalysis/PR21585.ll
test/Analysis/DependenceAnalysis/Preliminary.ll
test/Analysis/DependenceAnalysis/Propagating.ll
test/Analysis/DependenceAnalysis/Separability.ll
test/Analysis/DependenceAnalysis/StrongSIV.ll
test/Analysis/DependenceAnalysis/SymbolicRDIV.ll
test/Analysis/DependenceAnalysis/SymbolicSIV.ll
test/Analysis/DependenceAnalysis/UsefulGEP.ll
test/Analysis/DependenceAnalysis/WeakCrossingSIV.ll
test/Analysis/DependenceAnalysis/WeakZeroDstSIV.ll
test/Analysis/DependenceAnalysis/WeakZeroSrcSIV.ll
test/Analysis/DependenceAnalysis/ZIV.ll

index c8ec737a2cb91ec7fad5f104568ee02e823e234e..69d0e2c1513e3a002532f787aa938920dcefe5dd 100644 (file)
@@ -936,6 +936,17 @@ template <typename T> class ArrayRef;
     friend struct AnalysisInfoMixin<DependenceAnalysis>;
   }; // class DependenceAnalysis
 
+  /// Printer pass to dump DA results.
+  struct DependenceAnalysisPrinterPass
+      : public PassInfoMixin<DependenceAnalysisPrinterPass> {
+    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:
index b544ae5f535d3abf27249771db6e8236a67bfc77..3f4dfa52e1da1b1f4b0c97df7f187f8f9595d12f 100644 (file)
@@ -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<DependenceAnalysis>(F));
+  return PreservedAnalyses::all();
+}
+
 //===----------------------------------------------------------------------===//
 // Dependence methods
 
index f20b597a8f02f0600a8fae50aa3fae7ee713cfca..a8c03ad05968f9e924193e83d46f5a15d607d403 100644 (file)
@@ -201,6 +201,7 @@ FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
 FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
 FUNCTION_PASS("print<block-freq>", BlockFrequencyPrinterPass(dbgs()))
 FUNCTION_PASS("print<branch-prob>", BranchProbabilityPrinterPass(dbgs()))
+FUNCTION_PASS("print<da>", DependenceAnalysisPrinterPass(dbgs()))
 FUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
 FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
 FUNCTION_PASS("print<demanded-bits>", DemandedBitsPrinterPass(dbgs()))
index 0d213e25e134305f5292612c588ba2303cf4fcea..6f9c828798cc37b3be7889e7ef1eff1d26a7b8d8 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>"                            \
+; 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'
index 8c28231164ed278a55af003f83451a4239076560..5dda3a9030f403edb9d8bf9d6ac87d506fb6924e 100644 (file)
@@ -1,4 +1,8 @@
+; RUN: opt < %s -disable-output -da-delinearize=false "-passes=print<da>"      \
+; 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<da>" -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"
index 8de75df7dbdd7a98c2ed5ddf1a82d1f8569d4082..694e26afa09d457399cfa2340611b5e642d8f8f3 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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
index 42dfac767a7368b30a5338c1a046fd8a718ce6d8..2fbee702e8e5fe1b9ed82bba43dc13fee70d027d 100644 (file)
@@ -1,3 +1,4 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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.
 
index 709567105ba3703ce59ffd578cb93d7a775d8fa2..0480087145b5ef07a9a46122c4fdaad6e6c02cc0 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 8438c2bf425932bb00ccf0b9b2decf4bd47f4a7f..5c70624068522e5f382cac83028ac8f436159b2e 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 5b2488c1bc8ebeab5d565a33cf53dac12e3590a6..44b399cb191bf467036fab8b4cd6721caee7e44e 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
 
 ; ModuleID = 'ExactRDIV.bc'
index e815799fa994f928d74c700838868c3619bc8632..f3fba8258bdf596e398a2b0ad6c41f691be6c999 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index b0fcda4a6d5b81e58dd889b9c432f5183b4080f1..5f734b70f5c7bb62c51328afe950ae9787c2484a 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index c96412771bbc26ebe521f034ad4ac35fb0ef346d..6835582ac4c88ba8cd902af0af67d1e296402127 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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
index 64e72df55b8578332b561ef4f0d54e9c3384d3ca..d5dd1050b199060b174bba9d8187b89620061427 100644 (file)
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -analyze -basicaa -da
+; RUN: opt < %s -passes="print<da>"
 
 ; 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
index f12e20f336a6a43199e107ec40a1f5d7dd43385d..801b3f6dd6ff8fd7bbd2eabb2fe45fbd58c48bbd 100644 (file)
@@ -1,3 +1,4 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1
 ; RUN: opt < %s -analyze -basicaa -da
 ;
 ; CHECK: da analyze - consistent input [S S]!
index afeb061eb5e5710578e6486a1b66e09b859feb33..3e2ef4367849bc5c92214bbd3bd552026428cd07 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 23af449ad51e7553b0fe640fcbca3a9bff384aaf..ff42ba96b234336f352f5f48c866d2644c0c6fc4 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>"                            \
+; 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:
index 372d78a1acd3638fd4a1b95db7c7db395dc31dab..2c7e5dd0db3ba18b6539bae9196dc87291460e7a 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 0aa2567c9969f78cba4aad0b4763dfbfe32a7195..64d6a9cfae04e4acb4ce5a9237b0764318474443 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 8e6c775fedb632d6e53feeb8c8f5a89d350ab95f..b6004b8d5eee57ed6c9c811a7628959fbe3beb26 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 4a6136e98262b9fc77629205e93f4ec7f878a64e..f7528a52316f902b11be0c25dbd171dd6905a818 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 6e8b98ca26433c44206509e11441c0af963747bc..34c1415aeb5e93ada29c58672a62799b6684635c 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
 
 ; ModuleID = 'SymbolicRDIV.bc'
index 26c4770907b6d2f1a7af95d18cc096f1a0eda35f..b24547f73807e7362e9508adc76af08de1df7dfe 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index cd46a275034cd0e40015059543f0679a505ebcbe..283fd2ce2e77039bccfe75bb3f3966645ce5b423 100644 (file)
@@ -1,3 +1,4 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -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"
index 5b81ec10f9d824b9bed0485187243e436ef5cc78..119ae98bb530c76d9707f7aad82627f5f70005fb 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
 
 ; ModuleID = 'WeakCrossingSIV.bc'
index 128eb47018ae9bc33f0f73fed61254ad43abaa4c..37c912ca7165badc983160b68a0fc0e1ae03824f 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
 
 ; ModuleID = 'WeakZeroDstSIV.bc'
index 43c3de16935dfd93605061d59d393dd070e33011..602a79194e95629faad100e46095893528768ae0 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
 
 ; ModuleID = 'WeakZeroSrcSIV.bc'
index b3216415c8e85f7777332f0c32603b811129910c..c2049a629776092a2ad6d460993ad0675f3d2851 100644 (file)
@@ -1,3 +1,5 @@
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: | FileCheck %s
 ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
 
 ; ModuleID = 'ZIV.bc'