[llvm-branch-commits] [polly] [Polly] Remove ScopPass infrastructure (PR #125783)
Michael Kruse via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Feb 6 16:18:01 PST 2025
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/125783
>From 67ff7b622fef21d39c524d0de9d4659d2444ccfd Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Wed, 5 Feb 2025 00:51:47 +0100
Subject: [PATCH] Remove ScopPass infrastructure
---
polly/docs/ReleaseNotes.rst | 1 +
polly/include/polly/CodeGen/CodeGeneration.h | 13 +-
polly/include/polly/CodeGen/IslAst.h | 21 +-
polly/include/polly/CodePreparation.h | 7 +-
polly/include/polly/DeLICM.h | 21 +-
polly/include/polly/DeadCodeElimination.h | 8 -
polly/include/polly/DependenceInfo.h | 26 +-
polly/include/polly/ForwardOpTree.h | 25 +-
polly/include/polly/JSONExporter.h | 17 +-
polly/include/polly/MaximalStaticExpansion.h | 20 --
polly/include/polly/Pass/PhaseManager.h | 6 +-
polly/include/polly/PruneUnprofitable.h | 16 +-
polly/include/polly/ScheduleOptimizer.h | 24 +-
polly/include/polly/ScopGraphPrinter.h | 1 -
polly/include/polly/ScopInfo.h | 1 -
polly/include/polly/ScopPass.h | 264 ------------------
polly/include/polly/Simplify.h | 29 +-
polly/lib/Analysis/DependenceInfo.cpp | 27 --
polly/lib/Analysis/PruneUnprofitable.cpp | 16 --
polly/lib/Analysis/ScopDetection.cpp | 1 -
polly/lib/Analysis/ScopInfo.cpp | 1 -
polly/lib/Analysis/ScopPass.cpp | 134 ---------
polly/lib/CMakeLists.txt | 1 -
polly/lib/CodeGen/CodeGeneration.cpp | 13 -
polly/lib/CodeGen/IslAst.cpp | 19 --
polly/lib/Exchange/JSONExporter.cpp | 27 --
polly/lib/Pass/PhaseManager.cpp | 2 +
polly/lib/Support/PollyPasses.def | 44 ---
polly/lib/Support/RegisterPasses.cpp | 133 +--------
polly/lib/Transform/CodePreparation.cpp | 14 -
polly/lib/Transform/DeLICM.cpp | 43 ---
polly/lib/Transform/DeadCodeElimination.cpp | 23 --
polly/lib/Transform/FlattenSchedule.cpp | 1 -
polly/lib/Transform/ForwardOpTree.cpp | 42 ---
polly/lib/Transform/MatmulOptimizer.cpp | 1 -
.../lib/Transform/MaximalStaticExpansion.cpp | 42 ---
polly/lib/Transform/ScheduleOptimizer.cpp | 39 +--
polly/lib/Transform/ScopInliner.cpp | 1 -
polly/lib/Transform/Simplify.cpp | 35 ---
...invariant_load_base_pointer_conditional.ll | 2 +-
polly/unittests/CMakeLists.txt | 1 -
.../unittests/ScopPassManager/CMakeLists.txt | 7 -
.../ScopPassManager/PassManagerTest.cpp | 66 -----
43 files changed, 42 insertions(+), 1193 deletions(-)
delete mode 100644 polly/include/polly/ScopPass.h
delete mode 100644 polly/lib/Analysis/ScopPass.cpp
delete mode 100644 polly/unittests/ScopPassManager/CMakeLists.txt
delete mode 100644 polly/unittests/ScopPassManager/PassManagerTest.cpp
diff --git a/polly/docs/ReleaseNotes.rst b/polly/docs/ReleaseNotes.rst
index 215a802843304fb..6461af35e9625d9 100644
--- a/polly/docs/ReleaseNotes.rst
+++ b/polly/docs/ReleaseNotes.rst
@@ -17,3 +17,4 @@ In Polly |version| the following important changes have been incorporated.
* Polly's support for the legacy pass manager has been removed.
+ * The infrastructure around ScopPasses has been removed.
diff --git a/polly/include/polly/CodeGen/CodeGeneration.h b/polly/include/polly/CodeGen/CodeGeneration.h
index 2340fbe016b4937..bf0b8e69f46bb75 100644
--- a/polly/include/polly/CodeGen/CodeGeneration.h
+++ b/polly/include/polly/CodeGen/CodeGeneration.h
@@ -10,12 +10,16 @@
#define POLLY_CODEGENERATION_H
#include "polly/CodeGen/IRBuilder.h"
-#include "polly/ScopPass.h"
-#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+class RegionInfo;
+}
namespace polly {
class IslAstInfo;
+using llvm::BasicBlock;
+
enum VectorizerChoice {
VECTORIZER_NONE,
VECTORIZER_STRIPMINE,
@@ -28,11 +32,6 @@ extern VectorizerChoice PollyVectorizerChoice;
/// UnreachableInst.
void markBlockUnreachable(BasicBlock &Block, PollyIRBuilder &Builder);
-struct CodeGenerationPass final : PassInfoMixin<CodeGenerationPass> {
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &AR, SPMUpdater &U);
-};
-
extern bool PerfMonitoring;
bool runCodeGeneration(Scop &S, llvm::RegionInfo &RI, IslAstInfo &AI);
diff --git a/polly/include/polly/CodeGen/IslAst.h b/polly/include/polly/CodeGen/IslAst.h
index 3e1ff2c8a24da51..243ca46f9ba3215 100644
--- a/polly/include/polly/CodeGen/IslAst.h
+++ b/polly/include/polly/CodeGen/IslAst.h
@@ -22,12 +22,11 @@
#define POLLY_ISLAST_H
#include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/IR/PassManager.h"
#include "isl/ctx.h"
namespace polly {
+using llvm::raw_ostream;
using llvm::SmallPtrSet;
class Dependences;
@@ -164,24 +163,6 @@ class IslAstInfo {
///}
};
-struct IslAstAnalysis : AnalysisInfoMixin<IslAstAnalysis> {
- static AnalysisKey Key;
-
- using Result = IslAstInfo;
-
- IslAstInfo run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR);
-};
-
-struct IslAstPrinterPass final : PassInfoMixin<IslAstPrinterPass> {
- IslAstPrinterPass(raw_ostream &OS) : OS(OS) {}
-
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &, SPMUpdater &U);
-
- raw_ostream &OS;
-};
-
std::unique_ptr<IslAstInfo> runIslAstGen(Scop &S,
DependenceAnalysis::Result &DA);
} // namespace polly
diff --git a/polly/include/polly/CodePreparation.h b/polly/include/polly/CodePreparation.h
index 83011a3ef7b5bb6..662141ccb1d5198 100644
--- a/polly/include/polly/CodePreparation.h
+++ b/polly/include/polly/CodePreparation.h
@@ -13,19 +13,14 @@
#ifndef POLLY_CODEPREPARATION_H
#define POLLY_CODEPREPARATION_H
-#include "llvm/IR/PassManager.h"
-
namespace llvm {
class DominatorTree;
+class Function;
class LoopInfo;
class RegionInfo;
} // namespace llvm
namespace polly {
-struct CodePreparationPass final : llvm::PassInfoMixin<CodePreparationPass> {
- llvm::PreservedAnalyses run(llvm::Function &F,
- llvm::FunctionAnalysisManager &FAM);
-};
bool runCodePreparation(llvm::Function &F, llvm::DominatorTree *DT,
llvm::LoopInfo *LI, llvm::RegionInfo *RI);
diff --git a/polly/include/polly/DeLICM.h b/polly/include/polly/DeLICM.h
index 52542db39bb66ec..61f2218f8c2a859 100644
--- a/polly/include/polly/DeLICM.h
+++ b/polly/include/polly/DeLICM.h
@@ -17,33 +17,14 @@
#ifndef POLLY_DELICM_H
#define POLLY_DELICM_H
-#include "polly/ScopPass.h"
#include "isl/isl-noexceptions.h"
namespace llvm {
-class PassRegistry;
-class Pass;
class raw_ostream;
} // namespace llvm
namespace polly {
-
-struct DeLICMPass final : llvm::PassInfoMixin<DeLICMPass> {
- DeLICMPass() {}
-
- llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U);
-};
-
-struct DeLICMPrinterPass final : llvm::PassInfoMixin<DeLICMPrinterPass> {
- DeLICMPrinterPass(raw_ostream &OS) : OS(OS) {}
-
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
- ScopStandardAnalysisResults &SAR, SPMUpdater &);
-
-private:
- llvm::raw_ostream &OS;
-};
+class Scop;
/// Determine whether two lifetimes are conflicting.
///
diff --git a/polly/include/polly/DeadCodeElimination.h b/polly/include/polly/DeadCodeElimination.h
index 4d8da56c76eec73..e6aa900117274c6 100644
--- a/polly/include/polly/DeadCodeElimination.h
+++ b/polly/include/polly/DeadCodeElimination.h
@@ -14,17 +14,9 @@
#define POLLY_DEADCODEELIMINATION_H
#include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
namespace polly {
-struct DeadCodeElimPass final : llvm::PassInfoMixin<DeadCodeElimPass> {
- DeadCodeElimPass() {}
-
- llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U);
-};
-
bool runDeadCodeElim(Scop &S, DependenceAnalysis::Result &DA);
} // namespace polly
diff --git a/polly/include/polly/DependenceInfo.h b/polly/include/polly/DependenceInfo.h
index 9ef8b86ac4ff42f..de31bcf50663dd0 100644
--- a/polly/include/polly/DependenceInfo.h
+++ b/polly/include/polly/DependenceInfo.h
@@ -22,11 +22,20 @@
#ifndef POLLY_DEPENDENCE_INFO_H
#define POLLY_DEPENDENCE_INFO_H
-#include "polly/ScopPass.h"
+#include "llvm/ADT/DenseMap.h"
#include "isl/ctx.h"
#include "isl/isl-noexceptions.h"
+namespace llvm {
+class raw_ostream;
+}
+
namespace polly {
+class MemoryAccess;
+class Scop;
+class ScopStmt;
+
+using llvm::DenseMap;
/// The accumulated dependence information for a SCoP.
///
@@ -194,8 +203,7 @@ class Dependences final {
extern Dependences::AnalysisLevel OptAnalysisLevel;
-struct DependenceAnalysis final : public AnalysisInfoMixin<DependenceAnalysis> {
- static AnalysisKey Key;
+struct DependenceAnalysis final {
struct Result {
Scop &S;
std::unique_ptr<Dependences> D[Dependences::NumAnalysisLevels];
@@ -220,18 +228,6 @@ struct DependenceAnalysis final : public AnalysisInfoMixin<DependenceAnalysis> {
/// dependencies.
void abandonDependences();
};
- Result run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR);
-};
-
-struct DependenceInfoPrinterPass final
- : PassInfoMixin<DependenceInfoPrinterPass> {
- DependenceInfoPrinterPass(raw_ostream &OS) : OS(OS) {}
-
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
- ScopStandardAnalysisResults &, SPMUpdater &);
-
- raw_ostream &OS;
};
DependenceAnalysis::Result runDependenceAnalysis(Scop &S);
diff --git a/polly/include/polly/ForwardOpTree.h b/polly/include/polly/ForwardOpTree.h
index 49c36cd0125e57c..0193a79208afd1b 100644
--- a/polly/include/polly/ForwardOpTree.h
+++ b/polly/include/polly/ForwardOpTree.h
@@ -13,31 +13,8 @@
#ifndef POLLY_FORWARDOPTREE_H
#define POLLY_FORWARDOPTREE_H
-#include "polly/ScopPass.h"
-
-namespace llvm {
-class PassRegistry;
-} // namespace llvm
-
namespace polly {
-
-struct ForwardOpTreePass final : llvm::PassInfoMixin<ForwardOpTreePass> {
- ForwardOpTreePass() {}
-
- llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U);
-};
-
-struct ForwardOpTreePrinterPass final
- : llvm::PassInfoMixin<ForwardOpTreePrinterPass> {
- ForwardOpTreePrinterPass(raw_ostream &OS) : OS(OS) {}
-
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
- ScopStandardAnalysisResults &SAR, SPMUpdater &);
-
-private:
- llvm::raw_ostream &OS;
-};
+class Scop;
/// Pass that redirects scalar reads to array elements that are known to contain
/// the same value.
diff --git a/polly/include/polly/JSONExporter.h b/polly/include/polly/JSONExporter.h
index 82a881c737064d7..821c0d70b67e30e 100644
--- a/polly/include/polly/JSONExporter.h
+++ b/polly/include/polly/JSONExporter.h
@@ -10,26 +10,15 @@
#define POLLY_JSONEXPORTER_H
#include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
-#include "llvm/IR/PassManager.h"
namespace polly {
-/// This pass exports a scop to a jscop file. The filename is generated from the
-/// concatenation of the function and scop name.
-struct JSONExportPass final : llvm::PassInfoMixin<JSONExportPass> {
- llvm::PreservedAnalyses run(Scop &, ScopAnalysisManager &,
- ScopStandardAnalysisResults &, SPMUpdater &);
-};
-
/// This pass imports a scop from a jscop file. The filename is deduced from the
/// concatenation of the function and scop name.
-struct JSONImportPass final : llvm::PassInfoMixin<JSONExportPass> {
- llvm::PreservedAnalyses run(Scop &, ScopAnalysisManager &,
- ScopStandardAnalysisResults &, SPMUpdater &);
-};
-
void runImportJSON(Scop &S, DependenceAnalysis::Result &DA);
+
+/// This pass exports a scop to a jscop file. The filename is generated from the
+/// concatenation of the function and scop name.
void runExportJSON(Scop &S);
} // namespace polly
diff --git a/polly/include/polly/MaximalStaticExpansion.h b/polly/include/polly/MaximalStaticExpansion.h
index 1f9fbcb1d6a70ad..974c35fc2953f17 100644
--- a/polly/include/polly/MaximalStaticExpansion.h
+++ b/polly/include/polly/MaximalStaticExpansion.h
@@ -15,29 +15,9 @@
#define POLLY_MAXIMALSTATICEXPANSION_H
#include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
-#include "llvm/IR/PassManager.h"
namespace polly {
-class MaximalStaticExpansionPass
- : public llvm::PassInfoMixin<MaximalStaticExpansionPass> {
-public:
- llvm::PreservedAnalyses run(Scop &, ScopAnalysisManager &,
- ScopStandardAnalysisResults &, SPMUpdater &);
-};
-
-struct MaximalStaticExpansionPrinterPass
- : llvm::PassInfoMixin<MaximalStaticExpansionPrinterPass> {
- MaximalStaticExpansionPrinterPass(raw_ostream &OS) : OS(OS) {}
-
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
- ScopStandardAnalysisResults &SAR, SPMUpdater &);
-
-private:
- llvm::raw_ostream &OS;
-};
-
void runMaximalStaticExpansion(Scop &S, DependenceAnalysis::Result &DI);
} // namespace polly
diff --git a/polly/include/polly/Pass/PhaseManager.h b/polly/include/polly/Pass/PhaseManager.h
index bbaca1a513719a9..40dd92a7f27ae00 100644
--- a/polly/include/polly/Pass/PhaseManager.h
+++ b/polly/include/polly/Pass/PhaseManager.h
@@ -17,14 +17,16 @@
#include "polly/DependenceInfo.h"
#include "llvm/ADT/Bitset.h"
+#include "llvm/IR/PassManager.h"
#include <stddef.h>
namespace llvm {
-class Function;
-class Error;
+template <typename EnumT> struct enum_iteration_traits;
} // namespace llvm
namespace polly {
+using llvm::Function;
+using llvm::StringRef;
/// Phases (in execution order) within the Polly pass.
enum class PassPhase {
diff --git a/polly/include/polly/PruneUnprofitable.h b/polly/include/polly/PruneUnprofitable.h
index a762e9c20af260d..16f08694e644558 100644
--- a/polly/include/polly/PruneUnprofitable.h
+++ b/polly/include/polly/PruneUnprofitable.h
@@ -13,22 +13,8 @@
#ifndef POLLY_PRUNEUNPROFITABLE_H
#define POLLY_PRUNEUNPROFITABLE_H
-#include "polly/ScopPass.h"
-
-namespace llvm {
-class Pass;
-class PassRegistry;
-} // namespace llvm
-
namespace polly {
-
-struct PruneUnprofitablePass final
- : llvm::PassInfoMixin<PruneUnprofitablePass> {
- PruneUnprofitablePass() {}
-
- llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U);
-};
+class Scop;
bool runPruneUnprofitable(Scop &S);
} // namespace polly
diff --git a/polly/include/polly/ScheduleOptimizer.h b/polly/include/polly/ScheduleOptimizer.h
index ac45572ba7ed519..00ac81654d8a7f5 100644
--- a/polly/include/polly/ScheduleOptimizer.h
+++ b/polly/include/polly/ScheduleOptimizer.h
@@ -10,28 +10,12 @@
#define POLLY_SCHEDULEOPTIMIZER_H
#include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
-namespace polly {
-
-struct IslScheduleOptimizerPass final
- : llvm::PassInfoMixin<IslScheduleOptimizerPass> {
- IslScheduleOptimizerPass() {}
-
- llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U);
-};
+namespace llvm {
+class TargetTransformInfo;
+}
-struct IslScheduleOptimizerPrinterPass final
- : llvm::PassInfoMixin<IslScheduleOptimizerPrinterPass> {
- IslScheduleOptimizerPrinterPass(raw_ostream &OS) : OS(OS) {}
-
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
- ScopStandardAnalysisResults &SAR, SPMUpdater &);
-
-private:
- llvm::raw_ostream &OS;
-};
+namespace polly {
void runIslScheduleOptimizer(Scop &S, llvm::TargetTransformInfo *TTI,
DependenceAnalysis::Result &Deps);
diff --git a/polly/include/polly/ScopGraphPrinter.h b/polly/include/polly/ScopGraphPrinter.h
index c4e669f0c3503dc..e85c237f9984ed1 100644
--- a/polly/include/polly/ScopGraphPrinter.h
+++ b/polly/include/polly/ScopGraphPrinter.h
@@ -22,7 +22,6 @@
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/RegionIterator.h"
#include "llvm/Analysis/RegionPrinter.h"
-#include "llvm/IR/PassManager.h"
namespace llvm {
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index 42d8f95cbffd7ef..fd5bc13fe360fb8 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -26,7 +26,6 @@
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
-#include "llvm/IR/PassManager.h"
#include "llvm/IR/ValueHandle.h"
#include "isl/isl-noexceptions.h"
#include <cassert>
diff --git a/polly/include/polly/ScopPass.h b/polly/include/polly/ScopPass.h
deleted file mode 100644
index 80ccd5717f96cf2..000000000000000
--- a/polly/include/polly/ScopPass.h
+++ /dev/null
@@ -1,264 +0,0 @@
-//===--------- ScopPass.h - Pass for Static Control Parts --------*-C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the ScopPass class. ScopPasses are just RegionPasses,
-// except they operate on Polly IR (Scop and ScopStmt) built by ScopInfo Pass.
-// Because they operate on Polly IR, not the LLVM IR, ScopPasses are not allowed
-// to modify the LLVM IR. Due to this limitation, the ScopPass class takes
-// care of declaring that no LLVM passes are invalidated.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef POLLY_SCOP_PASS_H
-#define POLLY_SCOP_PASS_H
-
-#include "polly/ScopInfo.h"
-#include "llvm/ADT/PriorityWorklist.h"
-#include "llvm/Analysis/TargetTransformInfo.h"
-#include "llvm/IR/PassManager.h"
-#include "llvm/IR/PassManagerImpl.h"
-
-namespace polly {
-using llvm::AllAnalysesOn;
-using llvm::AnalysisManager;
-using llvm::DominatorTreeAnalysis;
-using llvm::InnerAnalysisManagerProxy;
-using llvm::LoopAnalysis;
-using llvm::OuterAnalysisManagerProxy;
-using llvm::PassManager;
-using llvm::RegionInfoAnalysis;
-using llvm::ScalarEvolutionAnalysis;
-using llvm::SmallPriorityWorklist;
-using llvm::TargetIRAnalysis;
-using llvm::TargetTransformInfo;
-
-class Scop;
-class SPMUpdater;
-struct ScopStandardAnalysisResults;
-
-using ScopAnalysisManager =
- AnalysisManager<Scop, ScopStandardAnalysisResults &>;
-using ScopAnalysisManagerFunctionProxy =
- InnerAnalysisManagerProxy<ScopAnalysisManager, Function>;
-using FunctionAnalysisManagerScopProxy =
- OuterAnalysisManagerProxy<FunctionAnalysisManager, Scop,
- ScopStandardAnalysisResults &>;
-} // namespace polly
-
-namespace llvm {
-using polly::Scop;
-using polly::ScopAnalysisManager;
-using polly::ScopAnalysisManagerFunctionProxy;
-using polly::ScopInfo;
-using polly::ScopStandardAnalysisResults;
-using polly::SPMUpdater;
-
-template <>
-class InnerAnalysisManagerProxy<ScopAnalysisManager, Function>::Result {
-public:
- explicit Result(ScopAnalysisManager &InnerAM, ScopInfo &SI)
- : InnerAM(&InnerAM), SI(&SI) {}
- Result(Result &&R) : InnerAM(std::move(R.InnerAM)), SI(R.SI) {
- R.InnerAM = nullptr;
- }
- Result &operator=(Result &&RHS) {
- InnerAM = RHS.InnerAM;
- SI = RHS.SI;
- RHS.InnerAM = nullptr;
- return *this;
- }
- ~Result() {
- if (!InnerAM)
- return;
- InnerAM->clear();
- }
-
- ScopAnalysisManager &getManager() { return *InnerAM; }
-
- bool invalidate(Function &F, const PreservedAnalyses &PA,
- FunctionAnalysisManager::Invalidator &Inv);
-
-private:
- ScopAnalysisManager *InnerAM;
- ScopInfo *SI;
-};
-
-// A partial specialization of the require analysis template pass to handle
-// extra parameters
-template <typename AnalysisT>
-struct RequireAnalysisPass<AnalysisT, Scop, ScopAnalysisManager,
- ScopStandardAnalysisResults &, SPMUpdater &>
- : PassInfoMixin<
- RequireAnalysisPass<AnalysisT, Scop, ScopAnalysisManager,
- ScopStandardAnalysisResults &, SPMUpdater &>> {
- PreservedAnalyses run(Scop &L, ScopAnalysisManager &AM,
- ScopStandardAnalysisResults &AR, SPMUpdater &) {
- (void)AM.template getResult<AnalysisT>(L, AR);
- return PreservedAnalyses::all();
- }
-};
-
-template <>
-InnerAnalysisManagerProxy<ScopAnalysisManager, Function>::Result
-InnerAnalysisManagerProxy<ScopAnalysisManager, Function>::run(
- Function &F, FunctionAnalysisManager &FAM);
-
-template <>
-PreservedAnalyses
-PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &,
- SPMUpdater &>::run(Scop &InitialS, ScopAnalysisManager &AM,
- ScopStandardAnalysisResults &, SPMUpdater &);
-extern template class PassManager<Scop, ScopAnalysisManager,
- ScopStandardAnalysisResults &, SPMUpdater &>;
-extern template class InnerAnalysisManagerProxy<ScopAnalysisManager, Function>;
-extern template class OuterAnalysisManagerProxy<FunctionAnalysisManager, Scop,
- ScopStandardAnalysisResults &>;
-} // namespace llvm
-
-namespace polly {
-
-template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
-class OwningInnerAnalysisManagerProxy final
- : public InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT> {
-public:
- OwningInnerAnalysisManagerProxy()
- : InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT>(InnerAM) {}
- using Result = typename InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT,
- ExtraArgTs...>::Result;
- Result run(IRUnitT &IR, AnalysisManager<IRUnitT, ExtraArgTs...> &AM,
- ExtraArgTs...) {
- return Result(InnerAM);
- }
-
- AnalysisManagerT &getManager() { return InnerAM; }
-
-private:
- AnalysisManagerT InnerAM;
-};
-
-template <>
-OwningInnerAnalysisManagerProxy<ScopAnalysisManager, Function>::Result
-OwningInnerAnalysisManagerProxy<ScopAnalysisManager, Function>::run(
- Function &F, FunctionAnalysisManager &FAM);
-extern template class OwningInnerAnalysisManagerProxy<ScopAnalysisManager,
- Function>;
-
-using OwningScopAnalysisManagerFunctionProxy =
- OwningInnerAnalysisManagerProxy<ScopAnalysisManager, Function>;
-using ScopPassManager =
- PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &,
- SPMUpdater &>;
-
-struct ScopStandardAnalysisResults {
- DominatorTree &DT;
- ScopInfo &SI;
- ScalarEvolution &SE;
- LoopInfo &LI;
- RegionInfo &RI;
- TargetTransformInfo &TTI;
-};
-
-class SPMUpdater final {
-public:
- SPMUpdater(SmallPriorityWorklist<Region *, 4> &Worklist,
- ScopAnalysisManager &SAM)
- : InvalidateCurrentScop(false), Worklist(Worklist), SAM(SAM) {}
-
- bool invalidateCurrentScop() const { return InvalidateCurrentScop; }
-
- void invalidateScop(Scop &S) {
- if (&S == CurrentScop)
- InvalidateCurrentScop = true;
-
- Worklist.erase(&S.getRegion());
- SAM.clear(S, S.getName());
- }
-
-private:
- Scop *CurrentScop;
- bool InvalidateCurrentScop;
- SmallPriorityWorklist<Region *, 4> &Worklist;
- ScopAnalysisManager &SAM;
- template <typename ScopPassT> friend struct FunctionToScopPassAdaptor;
-};
-
-template <typename ScopPassT>
-struct FunctionToScopPassAdaptor final
- : PassInfoMixin<FunctionToScopPassAdaptor<ScopPassT>> {
- explicit FunctionToScopPassAdaptor(ScopPassT Pass) : Pass(std::move(Pass)) {}
-
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
- ScopDetection &SD = AM.getResult<ScopAnalysis>(F);
- ScopInfo &SI = AM.getResult<ScopInfoAnalysis>(F);
- if (SI.empty()) {
- // With no scops having been detected, no IR changes have been made and
- // therefore all analyses are preserved. However, we must still free the
- // Scop analysis results which may hold AssertingVH that cause an error
- // if its value is destroyed.
- PreservedAnalyses PA = PreservedAnalyses::all();
- PA.abandon<ScopInfoAnalysis>();
- PA.abandon<ScopAnalysis>();
- AM.invalidate(F, PA);
- return PreservedAnalyses::all();
- }
-
- SmallPriorityWorklist<Region *, 4> Worklist;
- for (auto &S : SI)
- if (S.second)
- Worklist.insert(S.first);
-
- ScopStandardAnalysisResults AR = {AM.getResult<DominatorTreeAnalysis>(F),
- AM.getResult<ScopInfoAnalysis>(F),
- AM.getResult<ScalarEvolutionAnalysis>(F),
- AM.getResult<LoopAnalysis>(F),
- AM.getResult<RegionInfoAnalysis>(F),
- AM.getResult<TargetIRAnalysis>(F)};
-
- ScopAnalysisManager &SAM =
- AM.getResult<ScopAnalysisManagerFunctionProxy>(F).getManager();
-
- SPMUpdater Updater{Worklist, SAM};
-
- while (!Worklist.empty()) {
- Region *R = Worklist.pop_back_val();
- if (!SD.isMaxRegionInScop(*R, /*Verify=*/false))
- 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);
- if (Updater.invalidateCurrentScop())
- SI.recompute();
- };
-
- // FIXME: For the same reason as we add a BarrierNoopPass in the legacy pass
- // manager, do not preserve any analyses. While CodeGeneration may preserve
- // IR analyses sufficiently to process another Scop in the same function (it
- // has to, otherwise the ScopDetection result itself would need to be
- // invalidated), it is not sufficient for other purposes. For instance,
- // CodeGeneration does not inform LoopInfo about new loops in the
- // Polly-generated IR.
- return PreservedAnalyses::none();
- }
-
-private:
- ScopPassT Pass;
-};
-
-template <typename ScopPassT>
-FunctionToScopPassAdaptor<ScopPassT>
-createFunctionToScopPassAdaptor(ScopPassT Pass) {
- return FunctionToScopPassAdaptor<ScopPassT>(std::move(Pass));
-}
-} // namespace polly
-
-#endif
diff --git a/polly/include/polly/Simplify.h b/polly/include/polly/Simplify.h
index 5ca9409374c063a..c4703384a77dc9c 100644
--- a/polly/include/polly/Simplify.h
+++ b/polly/include/polly/Simplify.h
@@ -13,16 +13,11 @@
#ifndef POLLY_TRANSFORM_SIMPLIFY_H
#define POLLY_TRANSFORM_SIMPLIFY_H
-#include "polly/ScopPass.h"
#include "llvm/ADT/SmallVector.h"
-namespace llvm {
-class PassRegistry;
-class Pass;
-} // namespace llvm
-
namespace polly {
class MemoryAccess;
+class Scop;
class ScopStmt;
/// Return a vector that contains MemoryAccesses in the order in
@@ -41,28 +36,6 @@ class ScopStmt;
/// undefined.
llvm::SmallVector<MemoryAccess *, 32> getAccessesInOrder(ScopStmt &Stmt);
-struct SimplifyPass final : PassInfoMixin<SimplifyPass> {
- SimplifyPass(int CallNo = 0) : CallNo(CallNo) {}
-
- llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &AR, SPMUpdater &U);
-
-private:
- int CallNo;
-};
-
-struct SimplifyPrinterPass final : PassInfoMixin<SimplifyPrinterPass> {
- SimplifyPrinterPass(raw_ostream &OS, int CallNo = 0)
- : OS(OS), CallNo(CallNo) {}
-
- PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
- ScopStandardAnalysisResults &, SPMUpdater &);
-
-private:
- raw_ostream &OS;
- int CallNo;
-};
-
bool runSimplify(Scop &S, int CallNo);
} // namespace polly
diff --git a/polly/lib/Analysis/DependenceInfo.cpp b/polly/lib/Analysis/DependenceInfo.cpp
index 5183fc5725ecee6..0f208ec74634bc0 100644
--- a/polly/lib/Analysis/DependenceInfo.cpp
+++ b/polly/lib/Analysis/DependenceInfo.cpp
@@ -858,33 +858,6 @@ void DependenceAnalysis::Result::abandonDependences() {
Deps.release();
}
-DependenceAnalysis::Result
-DependenceAnalysis::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR) {
- return {S, {}};
-}
-
-AnalysisKey DependenceAnalysis::Key;
-
-PreservedAnalyses
-DependenceInfoPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- auto &DI = SAM.getResult<DependenceAnalysis>(S, SAR);
-
- if (auto d = DI.D[OptAnalysisLevel].get()) {
- d->print(OS);
- return PreservedAnalyses::all();
- }
-
- // Otherwise create the dependences on-the-fly and print them
- Dependences D(S.getSharedIslCtx(), OptAnalysisLevel);
- D.calculateDependences(S);
- D.print(OS);
-
- return PreservedAnalyses::all();
-}
-
DependenceAnalysis::Result polly::runDependenceAnalysis(Scop &S) {
DependenceAnalysis::Result Result{S, {}};
return Result;
diff --git a/polly/lib/Analysis/PruneUnprofitable.cpp b/polly/lib/Analysis/PruneUnprofitable.cpp
index 40cc9178da0f395..7201d3d1e319f38 100644
--- a/polly/lib/Analysis/PruneUnprofitable.cpp
+++ b/polly/lib/Analysis/PruneUnprofitable.cpp
@@ -13,7 +13,6 @@
#include "polly/PruneUnprofitable.h"
#include "polly/ScopDetection.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/Debug.h"
@@ -79,18 +78,3 @@ bool polly::runPruneUnprofitable(Scop &S) {
return false;
}
-
-llvm::PreservedAnalyses
-PruneUnprofitablePass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U) {
- bool Changed = runPruneUnprofitable(S);
-
- if (!Changed)
- return PreservedAnalyses::all();
-
- PreservedAnalyses PA;
- PA.preserveSet<AllAnalysesOn<Module>>();
- PA.preserveSet<AllAnalysesOn<Function>>();
- PA.preserveSet<AllAnalysesOn<Loop>>();
- return PA;
-}
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 208f93b204b6912..0b96d7270e46f18 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -72,7 +72,6 @@
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
-#include "llvm/IR/PassManager.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Regex.h"
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index a00c18174ccf4b3..3f2d41f979a32b4 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -53,7 +53,6 @@
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
-#include "llvm/IR/PassManager.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Compiler.h"
diff --git a/polly/lib/Analysis/ScopPass.cpp b/polly/lib/Analysis/ScopPass.cpp
deleted file mode 100644
index 61417e799cfa528..000000000000000
--- a/polly/lib/Analysis/ScopPass.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-//===- ScopPass.cpp - The base class of Passes that operate on Polly IR ---===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains the definitions of the ScopPass members.
-//
-//===----------------------------------------------------------------------===//
-
-#include "polly/ScopPass.h"
-#include "polly/ScopInfo.h"
-#include "llvm/Analysis/BasicAliasAnalysis.h"
-#include "llvm/Analysis/GlobalsModRef.h"
-#include "llvm/Analysis/LazyBlockFrequencyInfo.h"
-#include "llvm/Analysis/LazyBranchProbabilityInfo.h"
-#include "llvm/Analysis/OptimizationRemarkEmitter.h"
-#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
-#include "llvm/Analysis/TargetTransformInfo.h"
-#include <optional>
-
-using namespace llvm;
-using namespace polly;
-
-namespace polly {
-template class OwningInnerAnalysisManagerProxy<ScopAnalysisManager, Function>;
-}
-
-namespace llvm {
-
-template class PassManager<Scop, ScopAnalysisManager,
- ScopStandardAnalysisResults &, SPMUpdater &>;
-template class InnerAnalysisManagerProxy<ScopAnalysisManager, Function>;
-template class OuterAnalysisManagerProxy<FunctionAnalysisManager, Scop,
- ScopStandardAnalysisResults &>;
-
-template <>
-PreservedAnalyses
-PassManager<Scop, ScopAnalysisManager, ScopStandardAnalysisResults &,
- SPMUpdater &>::run(Scop &S, ScopAnalysisManager &AM,
- ScopStandardAnalysisResults &AR, SPMUpdater &U) {
- auto PA = PreservedAnalyses::all();
- for (auto &Pass : Passes) {
- auto PassPA = Pass->run(S, AM, AR, U);
-
- AM.invalidate(S, PassPA);
- PA.intersect(std::move(PassPA));
- }
-
- // All analyses for 'this' Scop have been invalidated above.
- // If ScopPasses affect break other scops they have to propagate this
- // information through the updater
- PA.preserveSet<AllAnalysesOn<Scop>>();
- return PA;
-}
-
-bool ScopAnalysisManagerFunctionProxy::Result::invalidate(
- Function &F, const PreservedAnalyses &PA,
- FunctionAnalysisManager::Invalidator &Inv) {
-
- // First, check whether our ScopInfo is about to be invalidated
- auto PAC = PA.getChecker<ScopAnalysisManagerFunctionProxy>();
- if (!(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>()) ||
- Inv.invalidate<ScopInfoAnalysis>(F, PA) ||
- Inv.invalidate<ScalarEvolutionAnalysis>(F, PA) ||
- Inv.invalidate<LoopAnalysis>(F, PA) ||
- Inv.invalidate<DominatorTreeAnalysis>(F, PA)) {
-
- // As everything depends on ScopInfo, we must drop all existing results
- for (auto &S : *SI)
- if (auto *scop = S.second.get())
- if (InnerAM)
- InnerAM->clear(*scop, scop->getName());
-
- InnerAM = nullptr;
- return true; // Invalidate the proxy result as well.
- }
-
- bool allPreserved = PA.allAnalysesInSetPreserved<AllAnalysesOn<Scop>>();
-
- // Invalidate all non-preserved analyses
- // Even if all analyses were preserved, we still need to run deferred
- // invalidation
- for (auto &S : *SI) {
- std::optional<PreservedAnalyses> InnerPA;
- auto *scop = S.second.get();
- if (!scop)
- continue;
-
- if (auto *OuterProxy =
- InnerAM->getCachedResult<FunctionAnalysisManagerScopProxy>(*scop)) {
- for (const auto &InvPair : OuterProxy->getOuterInvalidations()) {
- auto *OuterAnalysisID = InvPair.first;
- const auto &InnerAnalysisIDs = InvPair.second;
-
- if (Inv.invalidate(OuterAnalysisID, F, PA)) {
- if (!InnerPA)
- InnerPA = PA;
- for (auto *InnerAnalysisID : InnerAnalysisIDs)
- InnerPA->abandon(InnerAnalysisID);
- }
- }
-
- if (InnerPA) {
- InnerAM->invalidate(*scop, *InnerPA);
- continue;
- }
- }
-
- if (!allPreserved)
- InnerAM->invalidate(*scop, PA);
- }
-
- return false; // This proxy is still valid
-}
-
-template <>
-ScopAnalysisManagerFunctionProxy::Result
-ScopAnalysisManagerFunctionProxy::run(Function &F,
- FunctionAnalysisManager &FAM) {
- return Result(*InnerAM, FAM.getResult<ScopInfoAnalysis>(F));
-}
-} // namespace llvm
-
-namespace polly {
-template <>
-OwningScopAnalysisManagerFunctionProxy::Result
-OwningScopAnalysisManagerFunctionProxy::run(Function &F,
- FunctionAnalysisManager &FAM) {
- return Result(InnerAM, FAM.getResult<ScopInfoAnalysis>(F));
-}
-} // namespace polly
diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt
index e4f196f151c9e6e..7c609fda0a61a64 100644
--- a/polly/lib/CMakeLists.txt
+++ b/polly/lib/CMakeLists.txt
@@ -48,7 +48,6 @@ add_llvm_pass_plugin(Polly
Analysis/ScopInfo.cpp
Analysis/ScopBuilder.cpp
Analysis/ScopGraphPrinter.cpp
- Analysis/ScopPass.cpp
Analysis/PruneUnprofitable.cpp
CodeGen/BlockGenerators.cpp
${ISL_CODEGEN_FILES}
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 3fceb306c2d7416..5e16c281df00f6b 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -34,7 +34,6 @@
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
-#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -309,18 +308,6 @@ static bool generateCode(Scop &S, IslAstInfo &AI, LoopInfo &LI,
return true;
}
-PreservedAnalyses CodeGenerationPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &AR,
- SPMUpdater &U) {
- auto &AI = SAM.getResult<IslAstAnalysis>(S, AR);
- if (generateCode(S, AI, AR.LI, AR.DT, AR.SE, AR.RI)) {
- U.invalidateScop(S);
- return PreservedAnalyses::none();
- }
-
- return PreservedAnalyses::all();
-}
-
bool polly::runCodeGeneration(Scop &S, RegionInfo &RI, IslAstInfo &AI) {
return generateCode(S, AI, *S.getLI(), *S.getDT(), *S.getSE(), RI);
}
diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp
index c23f4008845239b..6bebb2affc2e90b 100644
--- a/polly/lib/CodeGen/IslAst.cpp
+++ b/polly/lib/CodeGen/IslAst.cpp
@@ -32,7 +32,6 @@
#include "polly/Options.h"
#include "polly/ScopDetection.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Support/GICHelper.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/Function.h"
@@ -663,15 +662,6 @@ static std::unique_ptr<IslAstInfo> runIslAst(
return Ast;
}
-IslAstInfo IslAstAnalysis::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR) {
- auto GetDeps = [&](Dependences::AnalysisLevel Lvl) -> const Dependences & {
- return SAM.getResult<DependenceAnalysis>(S, SAR).getDependences(Lvl);
- };
-
- return std::move(*runIslAst(S, GetDeps));
-}
-
static __isl_give isl_printer *cbPrintUser(__isl_take isl_printer *P,
__isl_take isl_ast_print_options *O,
__isl_keep isl_ast_node *Node,
@@ -771,15 +761,6 @@ void IslAstInfo::print(raw_ostream &OS) {
isl_printer_free(P);
}
-AnalysisKey IslAstAnalysis::Key;
-PreservedAnalyses IslAstPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- auto &Ast = SAM.getResult<IslAstAnalysis>(S, SAR);
- Ast.print(OS);
- return PreservedAnalyses::all();
-}
-
std::unique_ptr<IslAstInfo>
polly::runIslAstGen(Scop &S, DependenceAnalysis::Result &DA) {
auto GetDeps = [&](Dependences::AnalysisLevel Lvl) -> const Dependences & {
diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp
index 7d30c030aa6e13b..e3920662ddd57d6 100644
--- a/polly/lib/Exchange/JSONExporter.cpp
+++ b/polly/lib/Exchange/JSONExporter.cpp
@@ -14,7 +14,6 @@
#include "polly/DependenceInfo.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Support/ISLTools.h"
#include "polly/Support/ScopLocation.h"
#include "llvm/ADT/Statistic.h"
@@ -716,32 +715,6 @@ static bool importScop(Scop &S, const Dependences &D, const DataLayout &DL,
return true;
}
-PreservedAnalyses JSONExportPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &) {
- exportScop(S);
- return PreservedAnalyses::all();
-}
-
-PreservedAnalyses JSONImportPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &) {
- const Dependences &D =
- SAM.getResult<DependenceAnalysis>(S, SAR).getDependences(
- Dependences::AL_Statement);
- const DataLayout &DL = S.getFunction().getParent()->getDataLayout();
-
- if (!importScop(S, D, DL))
- report_fatal_error("Tried to import a malformed jscop file.");
-
- // This invalidates all analyses on Scop.
- PreservedAnalyses PA;
- PA.preserveSet<AllAnalysesOn<Module>>();
- PA.preserveSet<AllAnalysesOn<Function>>();
- PA.preserveSet<AllAnalysesOn<Loop>>();
- return PA;
-}
-
void polly::runImportJSON(Scop &S, DependenceAnalysis::Result &DA) {
const Dependences &D = DA.getDependences(Dependences::AL_Statement);
const DataLayout &DL = S.getFunction().getParent()->getDataLayout();
diff --git a/polly/lib/Pass/PhaseManager.cpp b/polly/lib/Pass/PhaseManager.cpp
index 6eda5ba8c9d64a3..1a99f0cac334ddb 100644
--- a/polly/lib/Pass/PhaseManager.cpp
+++ b/polly/lib/Pass/PhaseManager.cpp
@@ -24,8 +24,10 @@
#include "polly/ScopGraphPrinter.h"
#include "polly/ScopInfo.h"
#include "polly/Simplify.h"
+#include "llvm/ADT/PriorityWorklist.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/Module.h"
#define DEBUG_TYPE "polly-pass"
diff --git a/polly/lib/Support/PollyPasses.def b/polly/lib/Support/PollyPasses.def
index 496839760a844d7..c95ffa36db48878 100644
--- a/polly/lib/Support/PollyPasses.def
+++ b/polly/lib/Support/PollyPasses.def
@@ -11,53 +11,9 @@ MODULE_PASS("polly-custom", createModuleToFunctionPassAdaptor(PollyFunctionPass(
CGSCC_PASS("polly-inline", ScopInlinerPass(), parseNoOptions)
#undef CGSCC_PASS
-#ifndef FUNCTION_ANALYSIS
-#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
-#endif
-FUNCTION_ANALYSIS("polly-detect", ScopAnalysis())
-FUNCTION_ANALYSIS("polly-function-scops", ScopInfoAnalysis())
-#undef FUNCTION_ANALYSIS
-
#ifndef FUNCTION_PASS
#define FUNCTION_PASS(NAME, CREATE_PASS, PARSER)
#endif
-FUNCTION_PASS("polly-prepare", CodePreparationPass(), parseNoOptions)
-FUNCTION_PASS("print<polly-detect>", ScopAnalysisPrinterPass(llvm::errs()), parseNoOptions)
-FUNCTION_PASS("print<polly-function-scops>", ScopInfoPrinterPass(llvm::errs()), parseNoOptions)
-FUNCTION_PASS("polly-scop-viewer", ScopViewer(), parseNoOptions)
-FUNCTION_PASS("polly-scop-only-viewer", ScopOnlyViewer(), parseNoOptions)
-FUNCTION_PASS("polly-scop-printer", ScopPrinter(), parseNoOptions)
-FUNCTION_PASS("polly-scop-only-printer", ScopOnlyPrinter(), parseNoOptions)
FUNCTION_PASS("polly", PollyFunctionPass(Opts), parsePollyDefaultOptions)
FUNCTION_PASS("polly-custom", PollyFunctionPass(Opts), parsePollyCustomOptions)
#undef FUNCTION_PASS
-
-#ifndef SCOP_ANALYSIS
-#define SCOP_ANALYSIS(NAME, CREATE_PASS)
-#endif
-SCOP_ANALYSIS("pass-instrumentation", llvm::PassInstrumentationAnalysis(PIC))
-SCOP_ANALYSIS("polly-ast", IslAstAnalysis())
-SCOP_ANALYSIS("polly-dependences", DependenceAnalysis())
-#undef SCOP_ANALYSIS
-
-#ifndef SCOP_PASS
-#define SCOP_PASS(NAME, CREATE_PASS)
-#endif
-SCOP_PASS("polly-export-jscop", JSONExportPass())
-SCOP_PASS("polly-import-jscop", JSONImportPass())
-SCOP_PASS("print<polly-ast>", IslAstPrinterPass(llvm::outs()))
-SCOP_PASS("print<polly-dependences>", DependenceInfoPrinterPass(llvm::outs()))
-SCOP_PASS("polly-codegen", CodeGenerationPass())
-SCOP_PASS("polly-simplify", SimplifyPass())
-SCOP_PASS("print<polly-simplify>", SimplifyPrinterPass(llvm::outs()))
-SCOP_PASS("polly-optree", ForwardOpTreePass())
-SCOP_PASS("print<polly-optree>", ForwardOpTreePrinterPass(llvm::outs()))
-SCOP_PASS("polly-delicm", DeLICMPass())
-SCOP_PASS("print<polly-delicm>", DeLICMPrinterPass(llvm::outs()))
-SCOP_PASS("polly-prune-unprofitable", PruneUnprofitablePass())
-SCOP_PASS("polly-opt-isl", IslScheduleOptimizerPass())
-SCOP_PASS("print<polly-opt-isl>", IslScheduleOptimizerPrinterPass(llvm::outs()))
-SCOP_PASS("polly-dce", DeadCodeElimPass())
-SCOP_PASS("polly-mse", MaximalStaticExpansionPass())
-SCOP_PASS("print<polly-mse>", MaximalStaticExpansionPrinterPass(llvm::outs()))
-#undef SCOP_PASS
diff --git a/polly/lib/Support/RegisterPasses.cpp b/polly/lib/Support/RegisterPasses.cpp
index a22c21d44115925..ec25521c5f9dfbb 100644
--- a/polly/lib/Support/RegisterPasses.cpp
+++ b/polly/lib/Support/RegisterPasses.cpp
@@ -539,33 +539,6 @@ static llvm::Expected<std::monostate> parseNoOptions(StringRef Params) {
return std::monostate{};
}
-static OwningScopAnalysisManagerFunctionProxy
-createScopAnalyses(FunctionAnalysisManager &FAM,
- PassInstrumentationCallbacks *PIC) {
- OwningScopAnalysisManagerFunctionProxy Proxy;
-#define SCOP_ANALYSIS(NAME, CREATE_PASS) \
- Proxy.getManager().registerPass([PIC] { \
- (void)PIC; \
- return CREATE_PASS; \
- });
-#include "PollyPasses.def"
-
- Proxy.getManager().registerPass(
- [&FAM] { return FunctionAnalysisManagerScopProxy(FAM); });
- return Proxy;
-}
-
-static void registerFunctionAnalyses(FunctionAnalysisManager &FAM,
- PassInstrumentationCallbacks *PIC) {
-
-#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
- FAM.registerPass([] { return CREATE_PASS; });
-
-#include "PollyPasses.def"
-
- FAM.registerPass([&FAM, PIC] { return createScopAnalyses(FAM, PIC); });
-}
-
static llvm::Expected<bool>
parseCGPipeline(StringRef Name, llvm::CGSCCPassManager &CGPM,
PassInstrumentationCallbacks *PIC,
@@ -589,15 +562,6 @@ static llvm::Expected<bool>
parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
PassInstrumentationCallbacks *PIC,
ArrayRef<PassBuilder::PipelineElement> Pipeline) {
- if (llvm::parseAnalysisUtilityPasses<OwningScopAnalysisManagerFunctionProxy>(
- "polly-scop-analyses", Name, FPM))
- return true;
-
-#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
- if (llvm::parseAnalysisUtilityPasses< \
- std::remove_reference<decltype(CREATE_PASS)>::type>(NAME, Name, \
- FPM)) \
- return true;
#define FUNCTION_PASS(NAME, CREATE_PASS, PARSER) \
if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
@@ -614,84 +578,6 @@ parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
return false;
}
-static bool parseScopPass(StringRef Name, ScopPassManager &SPM,
- PassInstrumentationCallbacks *PIC) {
-#define SCOP_ANALYSIS(NAME, CREATE_PASS) \
- if (llvm::parseAnalysisUtilityPasses< \
- std::remove_reference<decltype(CREATE_PASS)>::type>(NAME, Name, \
- SPM)) \
- return true;
-
-#define SCOP_PASS(NAME, CREATE_PASS) \
- if (Name == NAME) { \
- SPM.addPass(CREATE_PASS); \
- return true; \
- }
-
-#include "PollyPasses.def"
-
- return false;
-}
-
-static bool parseScopPipeline(StringRef Name, FunctionPassManager &FPM,
- PassInstrumentationCallbacks *PIC,
- ArrayRef<PassBuilder::PipelineElement> Pipeline) {
- if (Name != "scop")
- return false;
- if (!Pipeline.empty()) {
- ScopPassManager SPM;
- for (const auto &E : Pipeline)
- if (!parseScopPass(E.Name, SPM, PIC))
- return false;
- FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
- }
- return true;
-}
-
-static bool isScopPassName(StringRef Name) {
-#define SCOP_ANALYSIS(NAME, CREATE_PASS) \
- if (Name == "require<" NAME ">") \
- return true; \
- if (Name == "invalidate<" NAME ">") \
- return true;
-
-#define SCOP_PASS(NAME, CREATE_PASS) \
- if (Name == NAME) \
- return true;
-
-#include "PollyPasses.def"
-
- return false;
-}
-
-static bool
-parseTopLevelPipeline(llvm::ModulePassManager &MPM,
- PassInstrumentationCallbacks *PIC,
- ArrayRef<PassBuilder::PipelineElement> Pipeline) {
- std::vector<PassBuilder::PipelineElement> FullPipeline;
- StringRef FirstName = Pipeline.front().Name;
-
- if (!isScopPassName(FirstName))
- return false;
-
- FunctionPassManager FPM;
- ScopPassManager SPM;
-
- for (auto &Element : Pipeline) {
- auto &Name = Element.Name;
- auto &InnerPipeline = Element.InnerPipeline;
- if (!InnerPipeline.empty()) // Scop passes don't have inner pipelines
- return false;
- if (!parseScopPass(Name, SPM, PIC))
- return false;
- }
-
- FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
- MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
-
- return true;
-}
-
static llvm::Expected<bool>
parseModulePipeline(StringRef Name, llvm::ModulePassManager &MPM,
PassInstrumentationCallbacks *PIC,
@@ -763,9 +649,6 @@ void registerPollyPasses(PassBuilder &PB) {
}
#include "PollyPasses.def"
- PB.registerAnalysisRegistrationCallback([PIC](FunctionAnalysisManager &FAM) {
- registerFunctionAnalyses(FAM, PIC);
- });
PB.registerPipelineParsingCallback(
[PIC](StringRef Name, FunctionPassManager &FPM,
ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
@@ -773,9 +656,10 @@ void registerPollyPasses(PassBuilder &PB) {
return Err(parseFunctionPipeline(Name, FPM, PIC, Pipeline));
});
PB.registerPipelineParsingCallback(
- [PIC](StringRef Name, FunctionPassManager &FPM,
+ [PIC](StringRef Name, ModulePassManager &MPM,
ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
- return parseScopPipeline(Name, FPM, PIC, Pipeline);
+ ExitOnError Err("Unable to parse Polly module pass: ");
+ return Err(parseModulePipeline(Name, MPM, PIC, Pipeline));
});
PB.registerPipelineParsingCallback(
[PIC](StringRef Name, CGSCCPassManager &CGPM,
@@ -783,17 +667,6 @@ void registerPollyPasses(PassBuilder &PB) {
ExitOnError Err("Unable to parse Polly call graph pass: ");
return Err(parseCGPipeline(Name, CGPM, PIC, Pipeline));
});
- PB.registerPipelineParsingCallback(
- [PIC](StringRef Name, ModulePassManager &MPM,
- ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
- ExitOnError Err("Unable to parse Polly module pass: ");
- return Err(parseModulePipeline(Name, MPM, PIC, Pipeline));
- });
- PB.registerParseTopLevelPipelineCallback(
- [PIC](llvm::ModulePassManager &MPM,
- ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
- return parseTopLevelPipeline(MPM, PIC, Pipeline);
- });
switch (PassPosition) {
case POSITION_EARLY:
diff --git a/polly/lib/Transform/CodePreparation.cpp b/polly/lib/Transform/CodePreparation.cpp
index 9aafce4c1b8f8d3..3e76dbdff129661 100644
--- a/polly/lib/Transform/CodePreparation.cpp
+++ b/polly/lib/Transform/CodePreparation.cpp
@@ -45,20 +45,6 @@ static bool runCodePreprationImpl(Function &F, DominatorTree *DT, LoopInfo *LI,
return true;
}
-PreservedAnalyses CodePreparationPass::run(Function &F,
- FunctionAnalysisManager &FAM) {
- auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
- auto &LI = FAM.getResult<LoopAnalysis>(F);
- bool Changed = runCodePreprationImpl(F, &DT, &LI, nullptr);
- if (!Changed)
- return PreservedAnalyses::all();
-
- PreservedAnalyses PA;
- PA.preserve<DominatorTreeAnalysis>();
- PA.preserve<LoopAnalysis>();
- return PA;
-}
-
bool polly::runCodePreparation(Function &F, DominatorTree *DT, LoopInfo *LI,
RegionInfo *RI) {
return runCodePreprationImpl(F, DT, LI, RI);
diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp
index e8f2d951404f3e8..4deace112f5b460 100644
--- a/polly/lib/Transform/DeLICM.cpp
+++ b/polly/lib/Transform/DeLICM.cpp
@@ -17,7 +17,6 @@
#include "polly/DeLICM.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLOStream.h"
#include "polly/Support/ISLTools.h"
@@ -1394,50 +1393,8 @@ static std::unique_ptr<DeLICMImpl> runDeLICMImpl(Scop &S, LoopInfo &LI) {
return Impl;
}
-
-static PreservedAnalyses runDeLICMUsingNPM(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U, raw_ostream *OS) {
- LoopInfo &LI = SAR.LI;
- std::unique_ptr<DeLICMImpl> Impl = runDeLICMImpl(S, LI);
-
- if (OS) {
- *OS << "Printing analysis 'Polly - DeLICM/DePRE' for region: '"
- << S.getName() << "' in function '" << S.getFunction().getName()
- << "':\n";
- if (Impl) {
- assert(Impl->getScop() == &S);
-
- *OS << "DeLICM result:\n";
- Impl->print(*OS);
- }
- }
-
- if (!Impl->isModified())
- return PreservedAnalyses::all();
-
- PreservedAnalyses PA;
- PA.preserveSet<AllAnalysesOn<Module>>();
- PA.preserveSet<AllAnalysesOn<Function>>();
- PA.preserveSet<AllAnalysesOn<Loop>>();
- return PA;
-}
} // anonymous namespace
-llvm::PreservedAnalyses polly::DeLICMPass::run(Scop &S,
- ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- return runDeLICMUsingNPM(S, SAM, SAR, U, nullptr);
-}
-
-llvm::PreservedAnalyses DeLICMPrinterPass::run(Scop &S,
- ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- return runDeLICMUsingNPM(S, SAM, SAR, U, &OS);
-}
-
bool polly::isConflicting(
isl::union_set ExistingOccupied, isl::union_set ExistingUnused,
isl::union_map ExistingKnown, isl::union_map ExistingWrites,
diff --git a/polly/lib/Transform/DeadCodeElimination.cpp b/polly/lib/Transform/DeadCodeElimination.cpp
index df95e5190431c0b..7cb7400c4728f52 100644
--- a/polly/lib/Transform/DeadCodeElimination.cpp
+++ b/polly/lib/Transform/DeadCodeElimination.cpp
@@ -143,26 +143,3 @@ bool polly::runDeadCodeElim(Scop &S, DependenceAnalysis::Result &DA) {
return Changed;
}
-
-llvm::PreservedAnalyses DeadCodeElimPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- DependenceAnalysis::Result &DA = SAM.getResult<DependenceAnalysis>(S, SAR);
- const Dependences &Deps = DA.getDependences(Dependences::AL_Statement);
-
- bool Changed = runDeadCodeElimination(S, DCEPreciseSteps, Deps);
-
- // FIXME: We can probably avoid the recomputation of all dependences by
- // updating them explicitly.
- if (Changed)
- DA.recomputeDependences(Dependences::AL_Statement);
-
- if (!Changed)
- return PreservedAnalyses::all();
-
- PreservedAnalyses PA;
- PA.preserveSet<AllAnalysesOn<Module>>();
- PA.preserveSet<AllAnalysesOn<Function>>();
- PA.preserveSet<AllAnalysesOn<Loop>>();
- return PA;
-}
diff --git a/polly/lib/Transform/FlattenSchedule.cpp b/polly/lib/Transform/FlattenSchedule.cpp
index 35a8ce6877036b9..3bb3c2ff761ead4 100644
--- a/polly/lib/Transform/FlattenSchedule.cpp
+++ b/polly/lib/Transform/FlattenSchedule.cpp
@@ -16,7 +16,6 @@
#include "polly/FlattenAlgo.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Support/ISLOStream.h"
#include "polly/Support/ISLTools.h"
#include "polly/Support/PollyDebug.h"
diff --git a/polly/lib/Transform/ForwardOpTree.cpp b/polly/lib/Transform/ForwardOpTree.cpp
index 24d4a4af6e68152..cf0ce79efd63c18 100644
--- a/polly/lib/Transform/ForwardOpTree.cpp
+++ b/polly/lib/Transform/ForwardOpTree.cpp
@@ -14,7 +14,6 @@
#include "polly/Options.h"
#include "polly/ScopBuilder.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLOStream.h"
#include "polly/Support/ISLTools.h"
@@ -1070,49 +1069,8 @@ static std::unique_ptr<ForwardOpTreeImpl> runForwardOpTreeImpl(Scop &S,
return Impl;
}
-
-static PreservedAnalyses
-runForwardOpTreeUsingNPM(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U,
- raw_ostream *OS) {
- LoopInfo &LI = SAR.LI;
-
- std::unique_ptr<ForwardOpTreeImpl> Impl = runForwardOpTreeImpl(S, LI);
- if (OS) {
- *OS << "Printing analysis 'Polly - Forward operand tree' for region: '"
- << S.getName() << "' in function '" << S.getFunction().getName()
- << "':\n";
- if (Impl) {
- assert(Impl->getScop() == &S);
-
- Impl->print(*OS);
- }
- }
-
- if (!Impl->isModified())
- return PreservedAnalyses::all();
-
- PreservedAnalyses PA;
- PA.preserveSet<AllAnalysesOn<Module>>();
- PA.preserveSet<AllAnalysesOn<Function>>();
- PA.preserveSet<AllAnalysesOn<Loop>>();
- return PA;
-}
} // namespace
-llvm::PreservedAnalyses ForwardOpTreePass::run(Scop &S,
- ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- return runForwardOpTreeUsingNPM(S, SAM, SAR, U, nullptr);
-}
-
-llvm::PreservedAnalyses
-ForwardOpTreePrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U) {
- return runForwardOpTreeUsingNPM(S, SAM, SAR, U, &OS);
-}
-
bool polly::runForwardOpTree(Scop &S) {
LoopInfo &LI = *S.getLI();
diff --git a/polly/lib/Transform/MatmulOptimizer.cpp b/polly/lib/Transform/MatmulOptimizer.cpp
index 01d431a97e7dbd7..7a6b3d25871c39d 100644
--- a/polly/lib/Transform/MatmulOptimizer.cpp
+++ b/polly/lib/Transform/MatmulOptimizer.cpp
@@ -11,7 +11,6 @@
#include "polly/Options.h"
#include "polly/ScheduleTreeTransform.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Simplify.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLTools.h"
diff --git a/polly/lib/Transform/MaximalStaticExpansion.cpp b/polly/lib/Transform/MaximalStaticExpansion.cpp
index 75aaf57510af1a0..c6fc19a2e069fe5 100644
--- a/polly/lib/Transform/MaximalStaticExpansion.cpp
+++ b/polly/lib/Transform/MaximalStaticExpansion.cpp
@@ -15,7 +15,6 @@
#include "polly/DependenceInfo.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Support/ISLTools.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringRef.h"
@@ -451,49 +450,8 @@ runMaximalStaticExpansionImpl(Scop &S, OptimizationRemarkEmitter &ORE,
Impl->expand();
return Impl;
}
-
-static PreservedAnalyses runMSEUsingNPM(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- raw_ostream *OS) {
- OptimizationRemarkEmitter ORE(&S.getFunction());
-
- auto &DI = SAM.getResult<DependenceAnalysis>(S, SAR);
- auto &D = DI.getDependences(Dependences::AL_Reference);
-
- std::unique_ptr<MaximalStaticExpansionImpl> Impl =
- runMaximalStaticExpansionImpl(S, ORE, D);
-
- if (OS) {
- *OS << "Printing analysis 'Polly - Maximal static expansion of SCoP' for "
- "region: '"
- << S.getName() << "' in function '" << S.getFunction().getName()
- << "':\n";
-
- if (Impl) {
- *OS << "MSE result:\n";
- Impl->print(*OS);
- }
- }
-
- return PreservedAnalyses::all();
-}
-
} // namespace
-PreservedAnalyses
-MaximalStaticExpansionPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &) {
- return runMSEUsingNPM(S, SAM, SAR, nullptr);
-}
-
-PreservedAnalyses
-MaximalStaticExpansionPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &) {
- return runMSEUsingNPM(S, SAM, SAR, &OS);
-}
-
void polly::runMaximalStaticExpansion(Scop &S, DependenceAnalysis::Result &DI) {
OptimizationRemarkEmitter ORE(&S.getFunction());
diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp
index 51907b3f0575b02..1150a98650af058 100644
--- a/polly/lib/Transform/ScheduleOptimizer.cpp
+++ b/polly/lib/Transform/ScheduleOptimizer.cpp
@@ -52,6 +52,7 @@
#include "polly/MatmulOptimizer.h"
#include "polly/Options.h"
#include "polly/ScheduleTreeTransform.h"
+#include "polly/ScopInfo.h"
#include "polly/Support/ISLOStream.h"
#include "polly/Support/ISLTools.h"
#include "llvm/ADT/Sequence.h"
@@ -931,44 +932,6 @@ static void runScheduleOptimizerPrinter(raw_ostream &OS,
} // namespace
-static llvm::PreservedAnalyses
-runIslScheduleOptimizerUsingNPM(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U,
- raw_ostream *OS) {
- DependenceAnalysis::Result &Deps = SAM.getResult<DependenceAnalysis>(S, SAR);
- auto GetDeps = [&Deps](Dependences::AnalysisLevel) -> const Dependences & {
- return Deps.getDependences(Dependences::AL_Statement);
- };
- OptimizationRemarkEmitter ORE(&S.getFunction());
- TargetTransformInfo *TTI = &SAR.TTI;
- isl::schedule LastSchedule;
- bool DepsChanged = false;
- runIslScheduleOptimizerImpl(S, GetDeps, TTI, &ORE, LastSchedule, DepsChanged);
- if (DepsChanged)
- Deps.abandonDependences();
-
- if (OS) {
- *OS << "Printing analysis 'Polly - Optimize schedule of SCoP' for region: '"
- << S.getName() << "' in function '" << S.getFunction().getName()
- << "':\n";
- runScheduleOptimizerPrinter(*OS, LastSchedule);
- }
- return PreservedAnalyses::all();
-}
-
-llvm::PreservedAnalyses
-IslScheduleOptimizerPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U) {
- return runIslScheduleOptimizerUsingNPM(S, SAM, SAR, U, nullptr);
-}
-
-llvm::PreservedAnalyses
-IslScheduleOptimizerPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- return runIslScheduleOptimizerUsingNPM(S, SAM, SAR, U, &OS);
-}
-
void polly::runIslScheduleOptimizer(Scop &S, TargetTransformInfo *TTI,
DependenceAnalysis::Result &Deps) {
auto GetDeps = [&Deps](Dependences::AnalysisLevel) -> const Dependences & {
diff --git a/polly/lib/Transform/ScopInliner.cpp b/polly/lib/Transform/ScopInliner.cpp
index 8e7a0dedaf53356..794ba98dc543c4d 100644
--- a/polly/lib/Transform/ScopInliner.cpp
+++ b/polly/lib/Transform/ScopInliner.cpp
@@ -21,7 +21,6 @@
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/IR/Dominators.h"
-#include "llvm/IR/PassManager.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Transforms/IPO/AlwaysInliner.h"
diff --git a/polly/lib/Transform/Simplify.cpp b/polly/lib/Transform/Simplify.cpp
index cf0f8c5ca5ef233..df88b5ea845591d 100644
--- a/polly/lib/Transform/Simplify.cpp
+++ b/polly/lib/Transform/Simplify.cpp
@@ -13,7 +13,6 @@
#include "polly/Simplify.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
-#include "polly/ScopPass.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLOStream.h"
#include "polly/Support/ISLTools.h"
@@ -761,42 +760,8 @@ void SimplifyImpl::printScop(raw_ostream &OS, Scop &S) const {
printAccesses(OS);
}
-static llvm::PreservedAnalyses
-runSimplifyUsingNPM(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U, int CallNo,
- raw_ostream *OS) {
- SimplifyImpl Impl(CallNo);
- Impl.run(S, &SAR.LI);
- if (OS) {
- *OS << "Printing analysis 'Polly - Simplify' for region: '" << S.getName()
- << "' in function '" << S.getFunction().getName() << "':\n";
- Impl.printScop(*OS, S);
- }
-
- if (!Impl.isModified())
- return llvm::PreservedAnalyses::all();
-
- PreservedAnalyses PA;
- PA.preserveSet<AllAnalysesOn<Module>>();
- PA.preserveSet<AllAnalysesOn<Function>>();
- PA.preserveSet<AllAnalysesOn<Loop>>();
- return PA;
-}
-
} // anonymous namespace
-llvm::PreservedAnalyses SimplifyPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR,
- SPMUpdater &U) {
- return runSimplifyUsingNPM(S, SAM, SAR, U, CallNo, nullptr);
-}
-
-llvm::PreservedAnalyses
-SimplifyPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &SAR, SPMUpdater &U) {
- return runSimplifyUsingNPM(S, SAM, SAR, U, CallNo, &OS);
-}
-
SmallVector<MemoryAccess *, 32> polly::getAccessesInOrder(ScopStmt &Stmt) {
SmallVector<MemoryAccess *, 32> Accesses;
diff --git a/polly/test/CodeGen/invariant_load_base_pointer_conditional.ll b/polly/test/CodeGen/invariant_load_base_pointer_conditional.ll
index 4dbcc3b3b049de3..1b4b5ebebd8efcb 100644
--- a/polly/test/CodeGen/invariant_load_base_pointer_conditional.ll
+++ b/polly/test/CodeGen/invariant_load_base_pointer_conditional.ll
@@ -13,7 +13,7 @@
; CHECK-NEXT: %polly.preload.tmp6.merge = phi ptr [ %polly.access.BPLoc.load, %polly.preload.exec ], [ null, %polly.preload.cond ]
;
; CHECK-LABEL: polly.stmt.bb5:
-; CHECK-NEXT: %[[offset:.*]] = shl nuw nsw i64 %polly.indvar6, 2
+; CHECK-NEXT: %[[offset:.*]] = shl nuw nsw i64 %polly.indvar16, 2
; CHECK-NEXT: %{{.*}} = getelementptr i8, ptr %polly.preload.tmp6.merge, i64 %[[offset]]
;
; void f(int **BPLoc, int *A, int N) {
diff --git a/polly/unittests/CMakeLists.txt b/polly/unittests/CMakeLists.txt
index 093a2146f63c5ea..7b91fd8e52537aa 100644
--- a/polly/unittests/CMakeLists.txt
+++ b/polly/unittests/CMakeLists.txt
@@ -27,6 +27,5 @@ endfunction()
add_subdirectory(Isl)
add_subdirectory(Flatten)
add_subdirectory(DeLICM)
-add_subdirectory(ScopPassManager)
add_subdirectory(ScheduleOptimizer)
add_subdirectory(Support)
diff --git a/polly/unittests/ScopPassManager/CMakeLists.txt b/polly/unittests/ScopPassManager/CMakeLists.txt
deleted file mode 100644
index 88300144af352e4..000000000000000
--- a/polly/unittests/ScopPassManager/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-add_polly_unittest(ScopPassManagerTests
- PassManagerTest.cpp
- )
-if (NOT LLVM_LINK_LLVM_DYLIB)
- llvm_map_components_to_libnames(llvm_libs Passes Core Analysis)
- target_link_libraries(ScopPassManagerTests PRIVATE ${llvm_libs})
-endif()
diff --git a/polly/unittests/ScopPassManager/PassManagerTest.cpp b/polly/unittests/ScopPassManager/PassManagerTest.cpp
deleted file mode 100644
index 49299c2124d6ea1..000000000000000
--- a/polly/unittests/ScopPassManager/PassManagerTest.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "llvm/IR/PassManager.h"
-#include "polly/CodeGen/IslAst.h"
-#include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
-#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Analysis/CGSCCPassManager.h"
-#include "llvm/Passes/PassBuilder.h"
-#include "llvm/Transforms/Scalar/LoopPassManager.h"
-#include "gtest/gtest.h"
-
-using namespace polly;
-using namespace llvm;
-
-namespace {
-class ScopPassRegistry : public ::testing::Test {
-protected:
- ModuleAnalysisManager MAM;
- FunctionAnalysisManager FAM;
- LoopAnalysisManager LAM;
- CGSCCAnalysisManager CGAM;
- ScopAnalysisManager SAM;
- AAManager AM;
-
-public:
- ScopPassRegistry(ScopPassRegistry &&) = delete;
- ScopPassRegistry(const ScopPassRegistry &) = delete;
- ScopPassRegistry &operator=(ScopPassRegistry &&) = delete;
- ScopPassRegistry &operator=(const ScopPassRegistry &) = delete;
- ScopPassRegistry() {
- PassBuilder PB;
-
- AM = PB.buildDefaultAAPipeline();
- PB.registerModuleAnalyses(MAM);
- PB.registerFunctionAnalyses(FAM);
- PB.registerLoopAnalyses(LAM);
- PB.registerCGSCCAnalyses(CGAM);
-
- FAM.registerPass([] { return ScopAnalysis(); });
- FAM.registerPass([] { return ScopInfoAnalysis(); });
- FAM.registerPass([this] { return ScopAnalysisManagerFunctionProxy(SAM); });
-
- // SAM.registerPass([] { return IslAstAnalysis(); });
- // SAM.registerPass([] { return DependenceAnalysis(); });
- SAM.registerPass([this] { return FunctionAnalysisManagerScopProxy(FAM); });
-
- PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
- }
-};
-
-TEST_F(ScopPassRegistry, PrintScops) {
- FunctionPassManager FPM;
- FPM.addPass(ScopAnalysisPrinterPass(errs()));
-}
-
-TEST_F(ScopPassRegistry, PrintScopInfo) {
- FunctionPassManager FPM;
- FPM.addPass(ScopInfoPrinterPass(errs()));
-}
-
-TEST_F(ScopPassRegistry, PrinIslAstInfo) {
- FunctionPassManager FPM;
- ScopPassManager SPM;
- // SPM.addPass(IslAstPrinterPass(errs()));
- FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
-}
-} // namespace
More information about the llvm-branch-commits
mailing list