[PATCH] D12694: Merge TempScopInfo into ScopInfo
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 08:00:12 PDT 2015
LGTM
On 09/08, Michael Kruse wrote:
> Meinersbur created this revision.
> Meinersbur added reviewers: grosser, jdoerfert.
> Meinersbur added subscribers: llvm-commits, pollydev.
> Meinersbur added a project: Polly.
> Herald added a subscriber: sanjoy.
>
> The TempScopInfo (-polly-analyze-ir) pass is removed and its work taken over by
> ScopInfo (-polly-scops). Several tests depend on -polly-analyze-ir and use
> -polly-scops instead which for the moment simplly prints the output of both
> passes. This again is not expected by some other passes which have been adapted.
>
> http://reviews.llvm.org/D12694
>
> Files:
> include/polly/LinkAllPasses.h
> include/polly/ScopInfo.h
> lib/Analysis/ScopInfo.cpp
> lib/CodeGen/CodeGeneration.cpp
> lib/Support/RegisterPasses.cpp
> test/ScopInfo/Alias-0.ll
> test/ScopInfo/Alias-1.ll
> test/ScopInfo/Alias-2.ll
> test/ScopInfo/Alias-3.ll
> test/ScopInfo/Alias-4.ll
> test/ScopInfo/aliasing_many_parameters_not_all_involved.ll
> test/ScopInfo/bug_2010_10_22.ll
> test/ScopInfo/bug_2011_1_5.ll
> test/ScopInfo/cond_in_loop.ll
> test/TempScop/inter_bb_scalar_dep.ll
> test/TempScop/intra_and_inter_bb_scalar_dep.ll
> test/TempScop/intra_bb_scalar_dep.ll
> test/TempScop/not-a-reduction.ll
> test/TempScop/scalar_to_array.ll
> test/TempScop/tempscop-printing.ll
>
> Index: test/TempScop/tempscop-printing.ll
> ===================================================================
> --- test/TempScop/tempscop-printing.ll
> +++ test/TempScop/tempscop-printing.ll
> @@ -1,4 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s -check-prefix=SCALARACCESS
> +; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-scops -analyze < %s | FileCheck %s -check-prefix=SCALARACCESS
>
> ; void f(long A[], int N, int *init_ptr) {
> ; long i, j;
> Index: test/TempScop/scalar_to_array.ll
> ===================================================================
> --- test/TempScop/scalar_to_array.ll
> +++ test/TempScop/scalar_to_array.ll
> @@ -1,5 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-scops -analyze < %s | FileCheck %s
>
> ; ModuleID = 'scalar_to_array.ll'
> 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"
> Index: test/TempScop/not-a-reduction.ll
> ===================================================================
> --- test/TempScop/not-a-reduction.ll
> +++ test/TempScop/not-a-reduction.ll
> @@ -1,4 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-analyze-ir -analyze < %s 2>&1 | not FileCheck %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s 2>&1 | not FileCheck %s
>
> ;#define TYPE float
> ;#define NUM 4
> @@ -47,4 +47,5 @@
> ret void
> }
>
> -; CHECK: Reduction
> +; Match any reduction type except "[Reduction Type: NONE]"
> +; CHECK: [Reduction Type: {{[^N].*}}]
> Index: test/TempScop/intra_bb_scalar_dep.ll
> ===================================================================
> --- test/TempScop/intra_bb_scalar_dep.ll
> +++ test/TempScop/intra_bb_scalar_dep.ll
> @@ -1,5 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-scops -analyze < %s | FileCheck %s
>
> ; void f(long A[], int N, int *init_ptr) {
> ; long i, j;
> Index: test/TempScop/intra_and_inter_bb_scalar_dep.ll
> ===================================================================
> --- test/TempScop/intra_and_inter_bb_scalar_dep.ll
> +++ test/TempScop/intra_and_inter_bb_scalar_dep.ll
> @@ -1,5 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-scops -analyze < %s | FileCheck %s
>
> ; void f(long A[], int N, int *init_ptr) {
> ; long i, j;
> Index: test/TempScop/inter_bb_scalar_dep.ll
> ===================================================================
> --- test/TempScop/inter_bb_scalar_dep.ll
> +++ test/TempScop/inter_bb_scalar_dep.ll
> @@ -1,5 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> -; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-analyze-ir -analyze < %s | FileCheck %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-scops -analyze < %s | FileCheck %s
>
> ; void f(long A[], int N, int *init_ptr) {
> ; long i, j;
> Index: test/ScopInfo/cond_in_loop.ll
> ===================================================================
> --- test/ScopInfo/cond_in_loop.ll
> +++ test/ScopInfo/cond_in_loop.ll
> @@ -1,4 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-analyze-ir -analyze < %s | not FileCheck %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s | FileCheck %s
>
> ;void f(long a[], long N, long M) {
> ; long i, j, k;
> @@ -44,4 +44,5 @@
> ret void
> }
>
> -; CHECK: Scop!
> +; CHECK-LABEL: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'bb => return' in function 'f':
> +; CHECK-NEXT: Scop: bb => return
> Index: test/ScopInfo/bug_2011_1_5.ll
> ===================================================================
> --- test/ScopInfo/bug_2011_1_5.ll
> +++ test/ScopInfo/bug_2011_1_5.ll
> @@ -1,4 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-analyze-ir -analyze < %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s
>
> ; Bug description: Alias Analysis thinks IntToPtrInst aliases with alloca instructions created by IndependentBlocks Pass.
> ; This will trigger the assertion when we are verifying the SCoP after IndependentBlocks.
> Index: test/ScopInfo/bug_2010_10_22.ll
> ===================================================================
> --- test/ScopInfo/bug_2010_10_22.ll
> +++ test/ScopInfo/bug_2010_10_22.ll
> @@ -1,4 +1,4 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-analyze-ir < %s
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops < %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"
>
> Index: test/ScopInfo/aliasing_many_parameters_not_all_involved.ll
> ===================================================================
> --- test/ScopInfo/aliasing_many_parameters_not_all_involved.ll
> +++ test/ScopInfo/aliasing_many_parameters_not_all_involved.ll
> @@ -4,11 +4,11 @@
> ; Check that we allow this SCoP even though it has 10 parameters involved in posisbly aliasing accesses.
> ; However, only 7 are involved in accesses through B, 8 through C and none in accesses through A.
> ;
> -; MAX8: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'for.cond => for.end' in function 'jd':
> -; MAX8-NEXT: Function: jd
> +; MAX8-LABEL: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'for.cond => for.end' in function 'jd':
> +; MAX8: Function: jd
>
> -; MAX7: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'for.cond => for.end' in function 'jd':
> -; MAX7-NEXT: Invalid Scop!
> +; MAX7-LABEL: Printing analysis 'Polly - Create polyhedral description of Scops' for region: 'for.cond => for.end' in function 'jd':
> +; MAX7: Invalid Scop!
> ;
> ; void jd(int *A, int *B, int *C, long p1, long p2, long p3, long p4, long p5,
> ; long p6, long p7, long p8, long p9, long p10) {
> Index: test/ScopInfo/Alias-4.ll
> ===================================================================
> --- test/ScopInfo/Alias-4.ll
> +++ test/ScopInfo/Alias-4.ll
> @@ -1,5 +1,5 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> ; REQUIRES: asserts
>
> 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"
> Index: test/ScopInfo/Alias-3.ll
> ===================================================================
> --- test/ScopInfo/Alias-3.ll
> +++ test/ScopInfo/Alias-3.ll
> @@ -1,5 +1,5 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> ; REQUIRES: asserts
>
> 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"
> Index: test/ScopInfo/Alias-2.ll
> ===================================================================
> --- test/ScopInfo/Alias-2.ll
> +++ test/ScopInfo/Alias-2.ll
> @@ -1,5 +1,5 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> ; REQUIRES: asserts
>
> 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"
> Index: test/ScopInfo/Alias-1.ll
> ===================================================================
> --- test/ScopInfo/Alias-1.ll
> +++ test/ScopInfo/Alias-1.ll
> @@ -1,5 +1,5 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> ; REQUIRES: asserts
>
> 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"
> Index: test/ScopInfo/Alias-0.ll
> ===================================================================
> --- test/ScopInfo/Alias-0.ll
> +++ test/ScopInfo/Alias-0.ll
> @@ -1,5 +1,5 @@
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> -; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-analyze-ir -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=RTA
> +; RUN: opt %loadPolly -polly-detect-unprofitable -polly-code-generator=isl -polly-scops -polly-use-runtime-alias-checks=false -analyze < %s -stats 2>&1 | FileCheck %s --check-prefix=NORTA
> ; REQUIRES: asserts
>
> 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"
> Index: lib/Support/RegisterPasses.cpp
> ===================================================================
> --- lib/Support/RegisterPasses.cpp
> +++ lib/Support/RegisterPasses.cpp
> @@ -154,7 +154,6 @@
> initializePollyCanonicalizePass(Registry);
> initializeScopDetectionPass(Registry);
> initializeScopInfoPass(Registry);
> - initializeTempScopInfoPass(Registry);
> }
>
> /// @brief Register Polly passes such that they form a polyhedral optimizer.
> Index: lib/CodeGen/CodeGeneration.cpp
> ===================================================================
> --- lib/CodeGen/CodeGeneration.cpp
> +++ lib/CodeGen/CodeGeneration.cpp
> @@ -178,7 +178,6 @@
> // FIXME: We do not yet add regions for the newly generated code to the
> // region tree.
> AU.addPreserved<RegionInfoPass>();
> - AU.addPreserved<TempScopInfo>();
> AU.addPreserved<ScopInfo>();
> AU.addPreservedID(IndependentBlocksID);
> }
> Index: lib/Analysis/ScopInfo.cpp
> ===================================================================
> --- lib/Analysis/ScopInfo.cpp
> +++ lib/Analysis/ScopInfo.cpp
> @@ -2388,9 +2388,9 @@
> return L->getLoopDepth() - OuterLoop->getLoopDepth();
> }
>
> -void TempScopInfo::buildPHIAccesses(PHINode *PHI, Region &R,
> - AccFuncSetType &Functions,
> - Region *NonAffineSubRegion) {
> +void ScopInfo::buildPHIAccesses(PHINode *PHI, Region &R,
> + AccFuncSetType &Functions,
> + Region *NonAffineSubRegion) {
> if (canSynthesize(PHI, LI, SE, &R))
> return;
>
> @@ -2442,8 +2442,8 @@
> }
> }
>
> -bool TempScopInfo::buildScalarDependences(Instruction *Inst, Region *R,
> - Region *NonAffineSubRegion) {
> +bool ScopInfo::buildScalarDependences(Instruction *Inst, Region *R,
> + Region *NonAffineSubRegion) {
> bool canSynthesizeInst = canSynthesize(Inst, LI, SE, R);
> if (isIgnoredIntrinsic(Inst))
> return false;
> @@ -2522,8 +2522,8 @@
> extern MapInsnToMemAcc InsnToMemAcc;
>
> IRAccess
> -TempScopInfo::buildIRAccess(Instruction *Inst, Loop *L, Region *R,
> - const ScopDetection::BoxedLoopsSetTy *BoxedLoops) {
> +ScopInfo::buildIRAccess(Instruction *Inst, Loop *L, Region *R,
> + const ScopDetection::BoxedLoopsSetTy *BoxedLoops) {
> unsigned Size;
> Type *SizeType;
> Value *Val;
> @@ -2579,7 +2579,7 @@
> Subscripts, Sizes, Val);
> }
>
> -void TempScopInfo::buildAccessFunctions(Region &R, Region &SR) {
> +void ScopInfo::buildAccessFunctions(Region &R, Region &SR) {
>
> if (SD->isNonAffineSubRegion(&SR, &R)) {
> for (BasicBlock *BB : SR.blocks())
> @@ -2594,8 +2594,8 @@
> buildAccessFunctions(R, *I->getNodeAs<BasicBlock>());
> }
>
> -void TempScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB,
> - Region *NonAffineSubRegion) {
> +void ScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB,
> + Region *NonAffineSubRegion) {
> AccFuncSetType Functions;
> Loop *L = LI->getLoopFor(&BB);
>
> @@ -2632,77 +2632,40 @@
> Accs.insert(Accs.end(), Functions.begin(), Functions.end());
> }
>
> -TempScop *TempScopInfo::buildTempScop(Region &R) {
> +TempScop *ScopInfo::buildTempScop(Region &R) {
> TempScop *TScop = new TempScop(R, AccFuncMap);
>
> buildAccessFunctions(R, R);
>
> return TScop;
> }
>
> -TempScop *TempScopInfo::getTempScop() const { return TempScopOfRegion; }
> +TempScop *ScopInfo::getTempScop() const { return TempScopOfRegion; }
>
> -void TempScopInfo::print(raw_ostream &OS, const Module *) const {
> +void ScopInfo::print(raw_ostream &OS, const Module *) const {
> if (TempScopOfRegion)
> TempScopOfRegion->print(OS, SE, LI);
> -}
> -
> -bool TempScopInfo::runOnRegion(Region *R, RGPassManager &RGM) {
> - SD = &getAnalysis<ScopDetection>();
> -
> - if (!SD->isMaxRegionInScop(*R))
> - return false;
> -
> - Function *F = R->getEntry()->getParent();
> - SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
> - LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
> - AA = &getAnalysis<AliasAnalysis>();
> - TD = &F->getParent()->getDataLayout();
> - ZeroOffset = SE->getConstant(TD->getIntPtrType(F->getContext()), 0);
> -
> - assert(!TempScopOfRegion && "Build the TempScop only once");
> - TempScopOfRegion = buildTempScop(*R);
> -
> - return false;
> -}
>
> -void TempScopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
> - AU.addRequiredTransitive<LoopInfoWrapperPass>();
> - AU.addRequiredTransitive<ScalarEvolutionWrapperPass>();
> - AU.addRequiredTransitive<ScopDetection>();
> - AU.addRequiredID(IndependentBlocksID);
> - AU.addRequired<AliasAnalysis>();
> - AU.setPreservesAll();
> + if (scop)
> + scop->print(OS);
> + else
> + OS << "Invalid Scop!\n";
> }
>
> -TempScopInfo::~TempScopInfo() { clear(); }
> -
> -void TempScopInfo::clear() {
> +void ScopInfo::clear() {
> AccFuncMap.clear();
> if (TempScopOfRegion)
> delete TempScopOfRegion;
> TempScopOfRegion = nullptr;
> -}
> -
> -//===----------------------------------------------------------------------===//
> -// TempScop information extraction pass implement
> -char TempScopInfo::ID = 0;
> -
> -Pass *polly::createTempScopInfoPass() { return new TempScopInfo(); }
>
> -INITIALIZE_PASS_BEGIN(TempScopInfo, "polly-analyze-ir",
> - "Polly - Analyse the LLVM-IR in the detected regions",
> - false, false);
> -INITIALIZE_AG_DEPENDENCY(AliasAnalysis);
> -INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass);
> -INITIALIZE_PASS_DEPENDENCY(RegionInfoPass);
> -INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass);
> -INITIALIZE_PASS_END(TempScopInfo, "polly-analyze-ir",
> - "Polly - Analyse the LLVM-IR in the detected regions",
> - false, false)
> + if (scop) {
> + delete scop;
> + scop = 0;
> + }
> +}
>
> //===----------------------------------------------------------------------===//
> -ScopInfo::ScopInfo() : RegionPass(ID), scop(0) {
> +ScopInfo::ScopInfo() : RegionPass(ID), scop(0), TempScopOfRegion(nullptr) {
> ctx = isl_ctx_alloc();
> isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
> }
> @@ -2713,32 +2676,41 @@
> }
>
> void ScopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
> + AU.addRequiredID(IndependentBlocksID);
> AU.addRequired<LoopInfoWrapperPass>();
> AU.addRequired<RegionInfoPass>();
> AU.addRequired<DominatorTreeWrapperPass>();
> - AU.addRequired<ScalarEvolutionWrapperPass>();
> - AU.addRequired<ScopDetection>();
> - AU.addRequired<TempScopInfo>();
> + AU.addRequiredTransitive<ScalarEvolutionWrapperPass>();
> + AU.addRequiredTransitive<ScopDetection>();
> AU.addRequired<AliasAnalysis>();
> AU.setPreservesAll();
> }
>
> bool ScopInfo::runOnRegion(Region *R, RGPassManager &RGM) {
> - LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
> - AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
> - ScopDetection &SD = getAnalysis<ScopDetection>();
> - ScalarEvolution &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
> + SD = &getAnalysis<ScopDetection>();
> +
> + if (!SD->isMaxRegionInScop(*R))
> + return false;
> +
> + Function *F = R->getEntry()->getParent();
> + SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
> + LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
> + AA = &getAnalysis<AliasAnalysis>();
> + TD = &F->getParent()->getDataLayout();
> DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
> + ZeroOffset = SE->getConstant(TD->getIntPtrType(F->getContext()), 0);
>
> - TempScop *tempScop = getAnalysis<TempScopInfo>().getTempScop();
> + assert(!TempScopOfRegion && "Build the TempScop only once");
> + TempScopOfRegion = buildTempScop(*R);
>
> // This region is no Scop.
> - if (!tempScop) {
> + if (!TempScopOfRegion) {
> scop = nullptr;
> return false;
> }
>
> - scop = Scop::createFromTempScop(*tempScop, LI, SE, SD, AA, DT, ctx);
> + scop =
> + Scop::createFromTempScop(*TempScopOfRegion, *LI, *SE, *SD, *AA, DT, ctx);
>
> DEBUG(scop->print(dbgs()));
>
> @@ -2767,7 +2739,6 @@
> INITIALIZE_PASS_DEPENDENCY(RegionInfoPass);
> INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass);
> INITIALIZE_PASS_DEPENDENCY(ScopDetection);
> -INITIALIZE_PASS_DEPENDENCY(TempScopInfo);
> INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass);
> INITIALIZE_PASS_END(ScopInfo, "polly-scops",
> "Polly - Create polyhedral description of Scops", false,
> Index: include/polly/ScopInfo.h
> ===================================================================
> --- include/polly/ScopInfo.h
> +++ include/polly/ScopInfo.h
> @@ -1385,7 +1385,7 @@
> // Access function of bbs.
> AccFuncMapType &AccFuncMap;
>
> - friend class TempScopInfo;
> + friend class ScopInfo;
>
> explicit TempScop(Region &r, AccFuncMapType &accFuncMap)
> : R(r), AccFuncMap(accFuncMap) {}
> @@ -1428,14 +1428,14 @@
> };
>
> typedef std::map<const Region *, TempScop *> TempScopMapType;
> -//===----------------------------------------------------------------------===//
> -/// @brief The Function Pass to extract temporary information for Static control
> -/// part in llvm function.
> +
> +///===---------------------------------------------------------------------===//
> +/// @brief Build the Polly IR (Scop and ScopStmt) on a Region.
> ///
> -class TempScopInfo : public RegionPass {
> +class ScopInfo : public RegionPass {
> //===-------------------------------------------------------------------===//
> - TempScopInfo(const TempScopInfo &) = delete;
> - const TempScopInfo &operator=(const TempScopInfo &) = delete;
> + ScopInfo(const ScopInfo &) = delete;
> + const ScopInfo &operator=(const ScopInfo &) = delete;
>
> // The ScalarEvolution to help building Scop.
> ScalarEvolution *SE;
> @@ -1462,6 +1462,10 @@
> // The TempScop for this region.
> TempScop *TempScopOfRegion;
>
> + // The Scop
> + Scop *scop;
> + isl_ctx *ctx;
> +
> // Clear the context.
> void clear();
>
> @@ -1518,47 +1522,14 @@
>
> public:
> static char ID;
> - explicit TempScopInfo() : RegionPass(ID), TempScopOfRegion(nullptr) {}
> - ~TempScopInfo();
> + explicit ScopInfo();
> + ~ScopInfo();
>
> /// @brief Get the temporay Scop information in LLVM IR for this region.
> ///
> /// @return The Scop information in LLVM IR represent.
> TempScop *getTempScop() const;
>
> - /// @name RegionPass interface
> - //@{
> - virtual void getAnalysisUsage(AnalysisUsage &AU) const;
> - virtual void releaseMemory() { clear(); }
> - virtual bool runOnRegion(Region *R, RGPassManager &RGM);
> - virtual void print(raw_ostream &OS, const Module *) const;
> - //@}
> -};
> -
> -///===---------------------------------------------------------------------===//
> -/// @brief Build the Polly IR (Scop and ScopStmt) on a Region.
> -///
> -class ScopInfo : public RegionPass {
> - //===-------------------------------------------------------------------===//
> - ScopInfo(const ScopInfo &) = delete;
> - const ScopInfo &operator=(const ScopInfo &) = delete;
> -
> - // The Scop
> - Scop *scop;
> - isl_ctx *ctx;
> -
> - void clear() {
> - if (scop) {
> - delete scop;
> - scop = 0;
> - }
> - }
> -
> -public:
> - static char ID;
> - explicit ScopInfo();
> - ~ScopInfo();
> -
> /// @brief Try to build the Polly IR of static control part on the current
> /// SESE-Region.
> ///
> @@ -1573,20 +1544,14 @@
> virtual bool runOnRegion(Region *R, RGPassManager &RGM);
> virtual void getAnalysisUsage(AnalysisUsage &AU) const;
> virtual void releaseMemory() { clear(); }
> - virtual void print(raw_ostream &OS, const Module *) const {
> - if (scop)
> - scop->print(OS);
> - else
> - OS << "Invalid Scop!\n";
> - }
> + virtual void print(raw_ostream &OS, const Module *) const;
> //@}
> };
>
> } // end namespace polly
>
> namespace llvm {
> class PassRegistry;
> -void initializeTempScopInfoPass(llvm::PassRegistry &);
> void initializeScopInfoPass(llvm::PassRegistry &);
> }
>
> Index: include/polly/LinkAllPasses.h
> ===================================================================
> --- include/polly/LinkAllPasses.h
> +++ include/polly/LinkAllPasses.h
> @@ -42,7 +42,6 @@
> llvm::Pass *createIslAstInfoPass();
> llvm::Pass *createCodeGenerationPass();
> llvm::Pass *createIslScheduleOptimizerPass();
> -llvm::Pass *createTempScopInfoPass();
>
> extern char &IndependentBlocksID;
> extern char &CodePreparationID;
> @@ -74,7 +73,6 @@
> polly::createIslAstInfoPass();
> polly::createCodeGenerationPass();
> polly::createIslScheduleOptimizerPass();
> - polly::createTempScopInfoPass();
> }
> } PollyForcePassLinking; // Force link by creating a global definition.
> }
--
Johannes Doerfert
Researcher / PhD Student
Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.31
Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065 : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150908/01e235e6/attachment.sig>
More information about the llvm-commits
mailing list