Index: include/polly/ScopInfo.h =================================================================== --- include/polly/ScopInfo.h +++ include/polly/ScopInfo.h @@ -30,6 +30,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator_range.h" +#include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/Analysis/RegionPass.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/IR/DebugLoc.h" @@ -3179,6 +3180,8 @@ ScopInfoPrinterPass(raw_ostream &OS) : Stream(OS) {} PreservedAnalyses run(Function &, FunctionAnalysisManager &); + PreservedAnalyses run(LazyCallGraph::SCC &, CGSCCAnalysisManager &, + LazyCallGraph &, CGSCCUpdateResult &); raw_ostream &Stream; }; Index: include/polly/ScopPass.h =================================================================== --- include/polly/ScopPass.h +++ include/polly/ScopPass.h @@ -20,6 +20,7 @@ #include "polly/ScopInfo.h" #include "llvm/ADT/PriorityWorklist.h" +#include "llvm/Analysis/CGSCCPassManager.h" #include "llvm/Analysis/RegionPass.h" #include "llvm/IR/PassManager.h" @@ -47,6 +48,8 @@ using polly::ScopStandardAnalysisResults; using polly::SPMUpdater; +/// Implementation of ScopAnalysisManagerFunctionProxy +/// @{ template <> class InnerAnalysisManagerProxy::Result { public: @@ -77,6 +80,14 @@ ScopInfo *SI; }; +template <> +InnerAnalysisManagerProxy::Result +InnerAnalysisManagerProxy::run( + Function &F, FunctionAnalysisManager &AM); + +extern template class InnerAnalysisManagerProxy; +/// @} + // A partial specialization of the require analysis template pass to handle // extra parameters template @@ -92,11 +103,6 @@ } }; -template <> -InnerAnalysisManagerProxy::Result -InnerAnalysisManagerProxy::run( - Function &F, FunctionAnalysisManager &FAM); - template <> PreservedAnalyses PassManager; -extern template class InnerAnalysisManagerProxy; extern template class OuterAnalysisManagerProxy; } // namespace llvm @@ -113,10 +118,12 @@ template class OwningInnerAnalysisManagerProxy - : public InnerAnalysisManagerProxy { + : public InnerAnalysisManagerProxy { public: OwningInnerAnalysisManagerProxy() - : InnerAnalysisManagerProxy(InnerAM) {} + : InnerAnalysisManagerProxy( + InnerAM) {} using Result = typename InnerAnalysisManagerProxy::Result; Result run(IRUnitT &IR, AnalysisManager &AM, @@ -130,15 +137,19 @@ AnalysisManagerT InnerAM; }; +/// @name OwningScopAnalysisManagerFunctionProxy +/// @{ +using OwningScopAnalysisManagerFunctionProxy = + OwningInnerAnalysisManagerProxy; + template <> OwningInnerAnalysisManagerProxy::Result OwningInnerAnalysisManagerProxy::run( Function &F, FunctionAnalysisManager &FAM); extern template class OwningInnerAnalysisManagerProxy; +/// @} -using OwningScopAnalysisManagerFunctionProxy = - OwningInnerAnalysisManagerProxy; using ScopPassManager = PassManager; @@ -199,54 +210,55 @@ bool InvalidateCurrentScop; SmallPriorityWorklist &Worklist; ScopAnalysisManager &SAM; - template friend class FunctionToScopPassAdaptor; + template friend class CGSCCToScopPassAdaptor; }; template -class FunctionToScopPassAdaptor - : public PassInfoMixin> { +class CGSCCToScopPassAdaptor + : public PassInfoMixin> { public: - explicit FunctionToScopPassAdaptor(ScopPassT Pass) : Pass(std::move(Pass)) {} + explicit CGSCCToScopPassAdaptor(ScopPassT Pass) : Pass(std::move(Pass)) {} - PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) { + PreservedAnalyses run(LazyCallGraph::SCC &SCC, CGSCCAnalysisManager &CGAM, + LazyCallGraph &CG, CGSCCUpdateResult &) { PreservedAnalyses PA = PreservedAnalyses::all(); - auto &SD = AM.getResult(F); - auto &SI = AM.getResult(F); - if (SI.empty()) - return PA; - - SmallPriorityWorklist Worklist; - for (auto &S : SI) - if (S.second) - Worklist.insert(S.first); - - ScopStandardAnalysisResults AR = {AM.getResult(F), - AM.getResult(F), - AM.getResult(F), - AM.getResult(F), - AM.getResult(F)}; - - ScopAnalysisManager &SAM = - AM.getResult(F).getManager(); - - SPMUpdater Updater{Worklist, SAM}; - - while (!Worklist.empty()) { - Region *R = Worklist.pop_back_val(); - if (!SD.isMaxRegionInScop(*R)) - continue; - Scop *scop = SI.getScop(R); - if (!scop) - continue; - Updater.CurrentScop = scop; - Updater.InvalidateCurrentScop = false; - PreservedAnalyses PassPA = Pass.run(*scop, SAM, AR, Updater); - - SAM.invalidate(*scop, PassPA); - PA.intersect(std::move(PassPA)); - if (Updater.invalidateCurrentScop()) - SI.recompute(); - }; + for (auto &SCCNode : SCC) { + auto &F = SCCNode.getFunction(); + auto &AM = CGAM.getResult(SCC, CG) + .getManager(); + auto &SAM = + AM.getResult(F).getManager(); + auto &SI = AM.getResult(F); + if (SI.empty()) + return PA; + + SmallPriorityWorklist Worklist; + for (auto &S : SI) + if (S.second) + Worklist.insert(S.first); + + ScopStandardAnalysisResults AR = { + AM.getResult(F), SI, + AM.getResult(F), + AM.getResult(F), AM.getResult(F)}; + + SPMUpdater Updater{Worklist, SAM}; + + while (!Worklist.empty()) { + Region *R = Worklist.pop_back_val(); + Scop *scop = SI.getScop(R); + if (!scop) + continue; + Updater.CurrentScop = scop; + Updater.InvalidateCurrentScop = false; + PreservedAnalyses PassPA = Pass.run(*scop, SAM, AR, Updater); + + SAM.invalidate(*scop, PassPA); + PA.intersect(std::move(PassPA)); + if (Updater.invalidateCurrentScop()) + SI.recompute(); + } + } PA.preserveSet>(); PA.preserve(); @@ -264,9 +276,8 @@ }; template -FunctionToScopPassAdaptor -createFunctionToScopPassAdaptor(ScopPassT Pass) { - return FunctionToScopPassAdaptor(std::move(Pass)); +CGSCCToScopPassAdaptor createCGSCCToScopPassAdaptor(ScopPassT Pass) { + return CGSCCToScopPassAdaptor(std::move(Pass)); } } // namespace polly Index: lib/Analysis/ScopInfo.cpp =================================================================== --- lib/Analysis/ScopInfo.cpp +++ lib/Analysis/ScopInfo.cpp @@ -5154,6 +5154,19 @@ return PreservedAnalyses::all(); } +PreservedAnalyses ScopInfoPrinterPass::run(LazyCallGraph::SCC &SCC, + CGSCCAnalysisManager &CGAM, + LazyCallGraph &CG, + CGSCCUpdateResult &) { + for (auto &SCCNode : SCC) { + Function &F = SCCNode.getFunction(); + auto &FAM = + CGAM.getResult(SCC, CG).getManager(); + run(F, FAM); + } + return PreservedAnalyses::all(); +} + void ScopInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); AU.addRequired(); Index: lib/Analysis/ScopPass.cpp =================================================================== --- lib/Analysis/ScopPass.cpp +++ lib/Analysis/ScopPass.cpp @@ -60,7 +60,13 @@ namespace polly { template class OwningInnerAnalysisManagerProxy; +template <> +OwningScopAnalysisManagerFunctionProxy::Result +OwningScopAnalysisManagerFunctionProxy::run(Function &F, + FunctionAnalysisManager &AM) { + return Result(InnerAM, AM.getResult(F)); } +} // namespace polly namespace llvm { @@ -153,16 +159,7 @@ template <> ScopAnalysisManagerFunctionProxy::Result ScopAnalysisManagerFunctionProxy::run(Function &F, - FunctionAnalysisManager &FAM) { - return Result(*InnerAM, FAM.getResult(F)); + FunctionAnalysisManager &AM) { + return Result(*InnerAM, AM.getResult(F)); } } // namespace llvm - -namespace polly { -template <> -OwningScopAnalysisManagerFunctionProxy::Result -OwningScopAnalysisManagerFunctionProxy::run(Function &F, - FunctionAnalysisManager &FAM) { - return Result(InnerAM, FAM.getResult(F)); -} -} // namespace polly Index: lib/Support/PollyPasses.def =================================================================== --- lib/Support/PollyPasses.def +++ lib/Support/PollyPasses.def @@ -13,6 +13,12 @@ FUNCTION_PASS("print", ScopInfoPrinterPass(errs())) #undef FUNCTION_PASS +#ifndef CGSCC_PASS +#define CGSCC_PASS(NAME, CREATE_PASS) +#endif +CGSCC_PASS("print", ScopInfoPrinterPass(errs())) +#undef CGSCC_PASS + #ifndef SCOP_ANALYSIS #define SCOP_ANALYSIS(NAME, CREATE_PASS) #endif Index: lib/Support/RegisterPasses.cpp =================================================================== --- lib/Support/RegisterPasses.cpp +++ lib/Support/RegisterPasses.cpp @@ -454,7 +454,7 @@ PM.add(createCodegenCleanupPass()); } -static void buildDefaultPollyPipeline(FunctionPassManager &PM, +static void buildDefaultPollyPipeline(CGSCCPassManager &PM, PassBuilder::OptimizationLevel Level) { if (!polly::shouldEnablePolly()) return; @@ -506,16 +506,20 @@ llvm_unreachable("Hybrid Target with GPU support is not implemented"); #endif - PM.addPass(CodePreparationPass()); - PM.addPass(createFunctionToScopPassAdaptor(std::move(SPM))); - PM.addPass(PB.buildFunctionSimplificationPipeline( + FunctionPassManager FPM; + + FPM.addPass(CodePreparationPass()); + FPM.addPass(PB.buildFunctionSimplificationPipeline( Level, PassBuilder::ThinLTOPhase::None)); // Cleanup assert(!DumpAfter && "This option is not implemented"); assert(DumpAfterFile.empty() && "This option is not implemented"); if (CFGPrinter) - PM.addPass(llvm::CFGPrinterPass()); + FPM.addPass(llvm::CFGPrinterPass()); + + PM.addPass(CGSCCToScopPassAdaptor(std::move(SPM))); + PM.addPass(createCGSCCToFunctionPassAdaptor(std::move(FPM))); } /// Register Polly to be available as an optimizer @@ -567,17 +571,18 @@ llvm::PassManagerBuilder::EP_VectorizerStart, registerPollyScalarOptimizerLatePasses); -static OwningScopAnalysisManagerFunctionProxy -createScopAnalyses(FunctionAnalysisManager &FAM) { - OwningScopAnalysisManagerFunctionProxy Proxy; +static void registerScopAnalyses(FunctionAnalysisManager &AM) { + AM.registerPass([&AM] { + OwningScopAnalysisManagerFunctionProxy Proxy; #define SCOP_ANALYSIS(NAME, CREATE_PASS) \ Proxy.getManager().registerPass([] { return CREATE_PASS; }); #include "PollyPasses.def" - Proxy.getManager().registerPass( - [&FAM] { return FunctionAnalysisManagerScopProxy(FAM); }); - return Proxy; + Proxy.getManager().registerPass( + [&AM] { return FunctionAnalysisManagerScopProxy(AM); }); + return Proxy; + }); } static void registerFunctionAnalyses(FunctionAnalysisManager &FAM) { @@ -585,8 +590,19 @@ FAM.registerPass([] { return CREATE_PASS; }); #include "PollyPasses.def" +} - FAM.registerPass([&FAM] { return createScopAnalyses(FAM); }); +static bool +parseCGSCCPipeline(StringRef Name, CGSCCPassManager &PM, + ArrayRef Pipeline) { +#define CGSCC_PASS(NAME, CREATE_PASS) \ + if (Name == NAME) { \ + PM.addPass(CREATE_PASS); \ + return true; \ + } + +#include "PollyPasses.def" + return false; } static bool @@ -630,7 +646,7 @@ return false; } -static bool parseScopPipeline(StringRef Name, FunctionPassManager &FPM, +static bool parseScopPipeline(StringRef Name, CGSCCPassManager &PM, ArrayRef Pipeline) { if (Name != "scop") return false; @@ -639,7 +655,7 @@ for (const auto &E : Pipeline) if (!parseScopPass(E.Name, SPM)) return false; - FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM))); + PM.addPass(createCGSCCToScopPassAdaptor(std::move(SPM))); } return true; } @@ -670,7 +686,7 @@ if (!isScopPassName(FirstName)) return false; - FunctionPassManager FPM(DebugLogging); + CGSCCPassManager PM(DebugLogging); ScopPassManager SPM(DebugLogging); for (auto &Element : Pipeline) { @@ -682,10 +698,11 @@ return false; } - FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM))); - if (VerifyEachPass) - FPM.addPass(VerifierPass()); - MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM))); + PM.addPass(createCGSCCToScopPassAdaptor(std::move(SPM))); + // FIXME: When VerifyEachPass is enabled, we are supposed to add a + // VerifierPass to the pipeline here. However, there is no CGSCC-level + // verifier pass. + MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(PM))); if (VerifyEachPass) MPM.addPass(VerifierPass()); @@ -694,12 +711,14 @@ void RegisterPollyPasses(PassBuilder &PB) { PB.registerAnalysisRegistrationCallback(registerFunctionAnalyses); + PB.registerAnalysisRegistrationCallback(registerScopAnalyses); PB.registerPipelineParsingCallback(parseFunctionPipeline); + PB.registerPipelineParsingCallback(parseCGSCCPipeline); PB.registerPipelineParsingCallback(parseScopPipeline); PB.registerParseTopLevelPipelineCallback(parseTopLevelPipeline); if (PassPosition == POSITION_BEFORE_VECTORIZER) - PB.registerVectorizerStartEPCallback(buildDefaultPollyPipeline); + PB.registerCGSCCOptimizerLateEPCallback(buildDefaultPollyPipeline); // FIXME else Error? } } // namespace polly Index: test/Isl/CodeGen/constant_condition.ll =================================================================== --- test/Isl/CodeGen/constant_condition.ll +++ test/Isl/CodeGen/constant_condition.ll @@ -1,4 +1,8 @@ -;RUN: opt %loadPolly -polly-prepare -polly-ast -analyze < %s | FileCheck %s +; RUN: opt %loadPolly -disable-output \ +; RUN: "-passes=cgscc(function(polly-prepare),scop(print))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; +; RUN: opt %loadPolly -polly-prepare -polly-ast -analyze < %s | FileCheck %s ;#include ;int A[1]; Index: test/Isl/CodeGen/invariant_verify_function_failed.ll =================================================================== --- test/Isl/CodeGen/invariant_verify_function_failed.ll +++ test/Isl/CodeGen/invariant_verify_function_failed.ll @@ -1,4 +1,10 @@ -; RUN: opt %loadPolly -polly-detect -polly-codegen -polly-invariant-load-hoisting=true -analyze < %s | FileCheck %s +; RUN: opt %loadPolly -polly-invariant-load-hoisting=true -disable-output \ +; RUN: "-passes=cgscc(function(print),scop(polly-codegen))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s --allow-empty +; +; RUN: opt %loadPolly -polly-detect -polly-codegen \ +; RUN: -polly-invariant-load-hoisting=true -analyze < %s | \ +; RUN: FileCheck %s ; ; This crashed at some point as the pointer returned by the call ; to @__errno_location is invariant and defined in the SCoP but not Index: test/Isl/CodeGen/loop_with_condition_nested.ll =================================================================== --- test/Isl/CodeGen/loop_with_condition_nested.ll +++ test/Isl/CodeGen/loop_with_condition_nested.ll @@ -1,5 +1,14 @@ +; RUN: opt %loadPolly -disable-output "-passes=print" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; ; RUN: opt %loadPolly -basicaa -polly-ast -analyze < %s | FileCheck %s -; RUN: opt %loadPolly -basicaa -polly-codegen -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS +; +; RUN: opt %loadPolly -disable-output \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(print))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s -check-prefix=LOOPS +; +; RUN: opt %loadPolly -basicaa -polly-codegen -loops -analyze \ +; RUN: < %s | FileCheck %s -check-prefix=LEGACY_LOOPS ;#include @@ -211,5 +220,8 @@ ; CHECK: Stmt_bb9(c0); ; CHECK: } -; LOOPS-DAG: Loop at depth 1 containing: %bb1
,%bb2,%bb4,%bb7,%bb6,%bb8,%bb9,%bb10 -; LOOPS-DAG: Loop at depth 1 containing: %polly.loop_header
,%polly.cond,%polly.merge,%polly.then,%polly.else,%polly.stmt.bb7,%polly.cond3,%polly.merge4,%polly.then5,%polly.else6,%polly.stmt.bb6,%polly.stmt.bb9 +; LEGACY_LOOPS: Loop at depth 1 containing: %bb1
,%bb2,%bb4,%bb7,%bb6,%bb8,%bb9,%bb10 +; LEGACY_LOOPS: Loop at depth 1 containing: %polly.loop_header
,%polly.cond,%polly.merge,%polly.then,%polly.else,%polly.stmt.bb7,%polly.cond3,%polly.merge4,%polly.then5,%polly.else6,%polly.stmt.bb6,%polly.stmt.bb9 + +; LOOPS: Loop at depth 1 containing: %polly.loop_header
,%polly.cond,%polly.else,%polly.cond3,%polly.else6,%polly.then5,%polly.stmt.bb6,%polly.merge4,%polly.then,%polly.stmt.bb7,%polly.merge,%polly.stmt.bb9 +; LOOPS: Loop at depth 1 containing: %bb1
,%bb2,%bb4,%bb7,%bb6,%bb8,%bb9,%bb10 Index: test/Isl/CodeGen/perf_monitoring_trip_counts_per_scop.ll =================================================================== --- test/Isl/CodeGen/perf_monitoring_trip_counts_per_scop.ll +++ test/Isl/CodeGen/perf_monitoring_trip_counts_per_scop.ll @@ -1,4 +1,7 @@ -; RUN: opt %loadPolly -polly-codegen -polly-codegen-perf-monitoring \ +; RUN: opt %loadPolly -polly-codegen-perf-monitoring -S -passes=polly-codegen \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; +; RUN: opt %loadPolly -polly-codegen -polly-codegen-perf-monitoring \ ; RUN: -S < %s | FileCheck %s ; void f(long A[], long N) { @@ -61,8 +64,8 @@ } ; Declaration of globals - Check for cycles declaration. -; CHECK: @"__polly_perf_in_f_from__%next__to__%polly.merge_new_and_old_trip_count" = weak thread_local(initialexec) constant i64 0 -; CHECK: @"__polly_perf_in_g_from__%next__to__%polly.merge_new_and_old_trip_count" = weak thread_local(initialexec) constant i64 0 +; CHECK-DAG: @"__polly_perf_in_f_from__%next__to__%polly.merge_new_and_old_trip_count" = weak thread_local(initialexec) constant i64 0 +; CHECK-DAG: @"__polly_perf_in_g_from__%next__to__%polly.merge_new_and_old_trip_count" = weak thread_local(initialexec) constant i64 0 ; Bumping up number of cycles in f ; CHECK: %12 = load volatile i64, i64* @"__polly_perf_in_f_from__%next__to__%polly.merge_new_and_old_trip_count" Index: test/Isl/CodeGen/simple_vec_assign_scalar.ll =================================================================== --- test/Isl/CodeGen/simple_vec_assign_scalar.ll +++ test/Isl/CodeGen/simple_vec_assign_scalar.ll @@ -1,7 +1,16 @@ -; RUN: opt %loadPolly -basicaa -polly-codegen \ -; RUN: -polly-vectorizer=polly -dce -S < %s | FileCheck %s +; RUN: opt %loadPolly -polly-vectorizer=polly -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; +; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce -S \ +; RUN: < %s | FileCheck %s -; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=stripmine -dce -S < %s | FileCheck %s --check-prefix=STRIPMINE +; RUN: opt %loadPolly -polly-vectorizer=stripmine -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s --check-prefix=STRIPMINE --allow-empty +; +; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=stripmine -dce \ +; RUN: -S < %s | FileCheck %s --check-prefix=STRIPMINE ;#define N 1024 ;float A[N]; Index: test/Isl/CodeGen/simple_vec_assign_scalar_2.ll =================================================================== --- test/Isl/CodeGen/simple_vec_assign_scalar_2.ll +++ test/Isl/CodeGen/simple_vec_assign_scalar_2.ll @@ -1,4 +1,9 @@ -; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce -S < %s | FileCheck %s +; RUN: opt %loadPolly -polly-vectorizer=polly -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; +; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce -S \ +; RUN: < %s | FileCheck %s ;#define N 1024 ;float A[N]; Index: test/Isl/CodeGen/simple_vec_call_2.ll =================================================================== --- test/Isl/CodeGen/simple_vec_call_2.ll +++ test/Isl/CodeGen/simple_vec_call_2.ll @@ -1,5 +1,10 @@ -; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce \ -; RUN: -polly-invariant-load-hoisting=true -S < %s | FileCheck %s +; RUN: opt %loadPolly -polly-vectorizer=polly \ +; RUN: -polly-invariant-load-hoisting=true -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; +; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce \ +; RUN: -polly-invariant-load-hoisting=true -S < %s | 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" @A = common global [1024 x float] zeroinitializer, align 16 Index: test/Isl/CodeGen/simple_vec_cast.ll =================================================================== --- test/Isl/CodeGen/simple_vec_cast.ll +++ test/Isl/CodeGen/simple_vec_cast.ll @@ -1,5 +1,10 @@ -; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly \ -; RUN: -polly-invariant-load-hoisting=true -dce -S < %s | FileCheck %s +; RUN: opt %loadPolly -polly-vectorizer=polly \ +; RUN: -polly-invariant-load-hoisting=true -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; +; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly \ +; RUN: -polly-invariant-load-hoisting=true -dce -S < %s | 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" @A = common global [1024 x float] zeroinitializer, align 16 Index: test/Isl/CodeGen/simple_vec_large_width.ll =================================================================== --- test/Isl/CodeGen/simple_vec_large_width.ll +++ test/Isl/CodeGen/simple_vec_large_width.ll @@ -1,3 +1,7 @@ +; RUN: opt %loadPolly -polly-vectorizer=polly -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; ; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce -S < %s | 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" Index: test/Isl/CodeGen/simple_vec_stride_x.ll =================================================================== --- test/Isl/CodeGen/simple_vec_stride_x.ll +++ test/Isl/CodeGen/simple_vec_stride_x.ll @@ -1,3 +1,7 @@ +; RUN: opt %loadPolly -polly-vectorizer=polly -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; ; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce -S < %s | FileCheck %s ;#define N 1024 Index: test/Isl/CodeGen/simple_vec_two_stmts.ll =================================================================== --- test/Isl/CodeGen/simple_vec_two_stmts.ll +++ test/Isl/CodeGen/simple_vec_two_stmts.ll @@ -1,3 +1,7 @@ +; RUN: opt %loadPolly -polly-vectorizer=polly -S \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(dce))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; ; RUN: opt %loadPolly -basicaa -polly-codegen -polly-vectorizer=polly -dce -S < %s | 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" Index: test/Isl/single_loop_param_less_equal.ll =================================================================== --- test/Isl/single_loop_param_less_equal.ll +++ test/Isl/single_loop_param_less_equal.ll @@ -1,5 +1,17 @@ +; RUN: opt %loadPolly -disable-output "-passes=print" < %s 2>&1 \ +; RUN: -aa-pipeline=basic-aa | FileCheck %s +; ; RUN: opt %loadPolly -polly-ast -analyze < %s | FileCheck %s +; +; RUN: opt %loadPolly -S -passes=polly-codegen < %s 2>&1 -aa-pipeline=basic-aa \ +; RUN: | FileCheck %s -check-prefix=CODEGEN +; ; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s -check-prefix=CODEGEN +; +; RUN: opt %loadPolly -disable-output \ +; RUN: "-passes=cgscc(scop(polly-codegen),function(print))" < %s 2>&1 \ +; RUN: -aa-pipeline=basic-aa | FileCheck %s -check-prefix=LOOPS +; ; RUN: opt %loadPolly -polly-codegen -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS 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/ScopDetect/indvars.ll =================================================================== --- test/ScopDetect/indvars.ll +++ test/ScopDetect/indvars.ll @@ -1,3 +1,7 @@ +; RUN: opt %loadPolly -disable-output \ +; RUN: "-passes=cgscc(function(print),scop(polly-codegen))" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s +; ; RUN: opt %loadPolly -analyze -polly-detect -polly-codegen < %s | 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" Index: test/ScopDetect/only_func_flag.ll =================================================================== --- test/ScopDetect/only_func_flag.ll +++ test/ScopDetect/only_func_flag.ll @@ -1,3 +1,6 @@ +; RUN: opt %loadPolly -disable-output "-polly-only-func=f,g" \ +; RUN: "-passes=function(print)" < %s 2>&1 -aa-pipeline=basic-aa | \ +; RUN: FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze -polly-only-func=f,g < %s | FileCheck %s ; ; Check that the flag `-polly-only-func` limits analysis to `f` and `g`. Index: test/ScopInfo/NonAffine/non_affine_but_srem.ll =================================================================== --- test/ScopInfo/NonAffine/non_affine_but_srem.ll +++ test/ScopInfo/NonAffine/non_affine_but_srem.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops \ ; RUN: -analyze < %s | FileCheck %s ; Index: test/ScopInfo/aliasing_with_non_affine_access.ll =================================================================== --- test/ScopInfo/aliasing_with_non_affine_access.ll +++ test/ScopInfo/aliasing_with_non_affine_access.ll @@ -1,12 +1,26 @@ -; RUN: opt %loadPolly -analyze -polly-ast -polly-process-unprofitable -polly-allow-nonaffine < %s | FileCheck %s +; RUN: opt %loadPolly -disable-output -polly-process-unprofitable \ +; RUN: -polly-allow-nonaffine "-passes=print" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s -check-prefix=TEST1 +; +; RUN: opt %loadPolly -analyze -polly-ast -polly-process-unprofitable -polly-allow-nonaffine < %s | FileCheck %s -check-prefix=TEST1 +; +; RUN: opt %loadPolly -disable-output -polly-process-unprofitable \ +; RUN: -polly-allow-nonaffine "-passes=print" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s -check-prefix=TEST2 +; +; RUN: opt %loadPolly -analyze -polly-ast -polly-process-unprofitable -polly-allow-nonaffine < %s | FileCheck %s -check-prefix=TEST2 ; ; @test1 ; Make sure we generate the correct aliasing check for a fixed-size memset operation. -; CHECK: if (1 && (&MemRef_tmp0[15] <= &MemRef_tmp1[0] || &MemRef_tmp1[32] <= &MemRef_tmp0[14])) +; TEST1-LABEL: :: isl ast :: test1 :: +; TEST1-NEXT: {{^$}} +; TEST1-NEXT: if (1 && (&MemRef_tmp0[15] <= &MemRef_tmp1[0] || &MemRef_tmp1[32] <= &MemRef_tmp0[14])) ; ; @test2 ; Make sure we generate the correct aliasing check for a variable-size memset operation. -; CHECK: if (1 && (&MemRef_tmp0[15] <= &MemRef_tmp1[0] || &MemRef_tmp1[n] <= &MemRef_tmp0[14])) +; TEST2-LABEL: :: isl ast :: test2 :: +; TEST2-NEXT: {{^$}} +; TEST2-NEXT: if (1 && (&MemRef_tmp0[15] <= &MemRef_tmp1[0] || &MemRef_tmp1[n] <= &MemRef_tmp0[14])) ; ; @test3 ; We can't do anything interesting with a non-affine memset; just make sure it doesn't crash. Index: test/ScopInfo/eager-binary-and-or-conditions.ll =================================================================== --- test/ScopInfo/eager-binary-and-or-conditions.ll +++ test/ScopInfo/eager-binary-and-or-conditions.ll @@ -1,4 +1,8 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s +; RUN: opt %loadPolly -disable-output -passes=polly-codegen < %s 2>&1 \ +; RUN: -aa-pipeline=basic-aa ; RUN: opt %loadPolly -polly-codegen -analyze < %s ; ; void or(float *A, long n, long m) { Index: test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll =================================================================== --- test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll +++ test/ScopInfo/fortran_array_param_nonmalloc_nonvectored.ll @@ -1,3 +1,7 @@ +; RUN: opt %loadPolly -disable-output -polly-detect-fortran-arrays \ +; RUN: -polly-allow-nonaffine -polly-invariant-load-hoisting \ +; RUN: "-passes=function(print)" < %s 2>&1 -aa-pipeline=basic-aa | \ +; RUN: FileCheck %s ; RUN: opt %loadPolly -analyze -polly-detect-fortran-arrays \ ; RUN: -polly-scops -polly-allow-nonaffine -polly-invariant-load-hoisting < %s | FileCheck %s Index: test/ScopInfo/fortran_array_param_nonmalloc_nonvectored_read_and_write.ll =================================================================== --- test/ScopInfo/fortran_array_param_nonmalloc_nonvectored_read_and_write.ll +++ test/ScopInfo/fortran_array_param_nonmalloc_nonvectored_read_and_write.ll @@ -1,3 +1,7 @@ +; RUN: opt %loadPolly -disable-output -polly-detect-fortran-arrays \ +; RUN: -polly-allow-nonaffine -polly-ignore-aliasing \ +; RUN: "-passes=function(print)" < %s 2>&1 -aa-pipeline=basic-aa | \ +; RUN: FileCheck %s ; RUN: opt %loadPolly -analyze -polly-detect-fortran-arrays \ ; RUN: -polly-scops -polly-allow-nonaffine -polly-ignore-aliasing < %s | FileCheck %s Index: test/ScopInfo/integers.ll =================================================================== --- test/ScopInfo/integers.ll +++ test/ScopInfo/integers.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; Check that we correctly convert integers to isl values. Index: test/ScopInfo/multidim_fixedsize_different_dimensionality.ll =================================================================== --- test/ScopInfo/multidim_fixedsize_different_dimensionality.ll +++ test/ScopInfo/multidim_fixedsize_different_dimensionality.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; ; #define N 400 Index: test/ScopInfo/multidim_fold_constant_dim.ll =================================================================== --- test/ScopInfo/multidim_fold_constant_dim.ll +++ test/ScopInfo/multidim_fold_constant_dim.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output -S "-passes=function(print)" \ +; RUN: < %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze -S < %s | FileCheck %s ; ; struct com { Index: test/ScopInfo/reduction_simple_fp.ll =================================================================== --- test/ScopInfo/reduction_simple_fp.ll +++ test/ScopInfo/reduction_simple_fp.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; ; CHECK: Function: f_no_fast_math Index: test/ScopInfo/scalar_to_array.ll =================================================================== --- test/ScopInfo/scalar_to_array.ll +++ test/ScopInfo/scalar_to_array.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" \ +; RUN: -aa-pipeline=basic-aa < %s 2>&1 | FileCheck %s ; RUN: opt %loadPolly -basicaa -polly-scops -analyze < %s | FileCheck %s ; RUN: opt %loadPolly -basicaa -polly-function-scops -analyze < %s | FileCheck %s Index: test/ScopInfo/tempscop-printing.ll =================================================================== --- test/ScopInfo/tempscop-printing.ll +++ test/ScopInfo/tempscop-printing.ll @@ -1,3 +1,6 @@ +; RUN: opt %loadPolly -disable-output -polly-invariant-load-hoisting=true \ +; RUN: "-passes=function(print)" -aa-pipeline=basic-aa < %s 2>&1 | \ +; RUN: FileCheck %s ; RUN: opt %loadPolly -basicaa -polly-scops -analyze \ ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s Index: test/ScopInfo/wraping_signed_expr_0.ll =================================================================== --- test/ScopInfo/wraping_signed_expr_0.ll +++ test/ScopInfo/wraping_signed_expr_0.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; ; void f(int *A, char N, char p) { Index: test/ScopInfo/wraping_signed_expr_1.ll =================================================================== --- test/ScopInfo/wraping_signed_expr_1.ll +++ test/ScopInfo/wraping_signed_expr_1.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; ; void f(long *A, long N, long p) { Index: test/ScopInfo/wraping_signed_expr_slow_1.ll =================================================================== --- test/ScopInfo/wraping_signed_expr_slow_1.ll +++ test/ScopInfo/wraping_signed_expr_slow_1.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; ; This checks that the no-wraps checks will be computed fast as some example Index: test/ScopInfo/wraping_signed_expr_slow_2.ll =================================================================== --- test/ScopInfo/wraping_signed_expr_slow_2.ll +++ test/ScopInfo/wraping_signed_expr_slow_2.ll @@ -1,3 +1,5 @@ +; RUN: opt %loadPolly -disable-output "-passes=function(print)" < \ +; RUN: %s 2>&1 -aa-pipeline=basic-aa | FileCheck %s ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s ; ; This checks that the no-wraps checks will be computed fast as some example Index: unittests/ScopPassManager/PassManagerTest.cpp =================================================================== --- unittests/ScopPassManager/PassManagerTest.cpp +++ unittests/ScopPassManager/PassManagerTest.cpp @@ -58,9 +58,9 @@ } TEST_F(ScopPassRegistry, PrinIslAstInfo) { - FunctionPassManager FPM; + CGSCCPassManager PM; ScopPassManager SPM; // SPM.addPass(IslAstPrinterPass(errs())); - FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM))); + PM.addPass(createCGSCCToScopPassAdaptor(std::move(SPM))); } } // namespace