[polly] 934c82d - [Polly] Remove CodegenCleanupPass.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 04:39:47 PST 2023


Author: Florian Hahn
Date: 2023-02-24T13:39:32+01:00
New Revision: 934c82d31801e65aa3bbe99a0e64f903621c2e04

URL: https://github.com/llvm/llvm-project/commit/934c82d31801e65aa3bbe99a0e64f903621c2e04
DIFF: https://github.com/llvm/llvm-project/commit/934c82d31801e65aa3bbe99a0e64f903621c2e04.diff

LOG: [Polly] Remove CodegenCleanupPass.

The pass uses a bunch of deprecated legacy passes and appears unused.
Remove it to unblock removing legacy passes.

Fixes https://github.com/llvm/llvm-project/issues/60852

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D144332

Added: 
    

Modified: 
    polly/include/polly/CodeGen/CodegenCleanup.h
    polly/lib/CMakeLists.txt
    polly/lib/Support/RegisterPasses.cpp

Removed: 
    polly/lib/CodeGen/CodegenCleanup.cpp


################################################################################
diff  --git a/polly/include/polly/CodeGen/CodegenCleanup.h b/polly/include/polly/CodeGen/CodegenCleanup.h
index a1fd6805dfe5a..e69de29bb2d1d 100644
--- a/polly/include/polly/CodeGen/CodegenCleanup.h
+++ b/polly/include/polly/CodeGen/CodegenCleanup.h
@@ -1,17 +0,0 @@
-#ifndef POLLY_CODEGENCLEANUP_H
-#define POLLY_CODEGENCLEANUP_H
-
-namespace llvm {
-class FunctionPass;
-class PassRegistry;
-} // namespace llvm
-
-namespace polly {
-llvm::FunctionPass *createCodegenCleanupPass();
-} // namespace polly
-
-namespace llvm {
-void initializeCodegenCleanupPass(llvm::PassRegistry &);
-} // namespace llvm
-
-#endif

diff  --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt
index 5b58d0ba8d2d7..95e653f65da82 100644
--- a/polly/lib/CMakeLists.txt
+++ b/polly/lib/CMakeLists.txt
@@ -72,7 +72,6 @@ add_llvm_pass_plugin(Polly
   CodeGen/IRBuilder.cpp
   CodeGen/Utils.cpp
   CodeGen/RuntimeDebugBuilder.cpp
-  CodeGen/CodegenCleanup.cpp
   CodeGen/PerfMonitor.cpp
   ${GPGPU_CODEGEN_FILES}
   Exchange/JSONExporter.cpp

diff  --git a/polly/lib/CodeGen/CodegenCleanup.cpp b/polly/lib/CodeGen/CodegenCleanup.cpp
deleted file mode 100644
index e57475079788e..0000000000000
--- a/polly/lib/CodeGen/CodegenCleanup.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-//===- CodegenCleanup.cpp -------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "polly/CodeGen/CodegenCleanup.h"
-
-#include "llvm/Analysis/ScopedNoAliasAA.h"
-#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/LegacyPassManager.h"
-#include "llvm/Pass.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Transforms/InstCombine/InstCombine.h"
-#include "llvm/Transforms/Scalar.h"
-#include "llvm/Transforms/Scalar/GVN.h"
-#include "llvm/Transforms/Scalar/SimpleLoopUnswitch.h"
-#include "llvm/Transforms/Utils.h"
-
-#define DEBUG_TYPE "polly-cleanup"
-
-using namespace llvm;
-using namespace polly;
-
-namespace {
-
-class CodegenCleanup final : public FunctionPass {
-private:
-  CodegenCleanup(const CodegenCleanup &) = delete;
-  const CodegenCleanup &operator=(const CodegenCleanup &) = delete;
-
-  llvm::legacy::FunctionPassManager *FPM;
-
-public:
-  static char ID;
-  explicit CodegenCleanup() : FunctionPass(ID), FPM(nullptr) {}
-
-  /// @name FunctionPass interface
-  //@{
-  void getAnalysisUsage(llvm::AnalysisUsage &AU) const override {}
-
-  bool doInitialization(Module &M) override {
-    assert(!FPM);
-
-    FPM = new llvm::legacy::FunctionPassManager(&M);
-
-    // TODO: How to make parent passes discoverable?
-    // TODO: Should be sensitive to compiler options in PassManagerBuilder, to
-    // which we do not have access here.
-    FPM->add(createScopedNoAliasAAWrapperPass());
-    FPM->add(createTypeBasedAAWrapperPass());
-    FPM->add(createAAResultsWrapperPass());
-
-    // TODO: These are non-conditional passes that run between
-    // EP_ModuleOptimizerEarly and EP_VectorizerStart just to ensure we do not
-    // miss any optimization that would have run after Polly with
-    // -polly-position=early. This can probably be reduced to a more compact set
-    // of passes.
-    FPM->add(createCFGSimplificationPass());
-    FPM->add(createSROAPass());
-    FPM->add(createEarlyCSEPass());
-
-    FPM->add(createPromoteMemoryToRegisterPass());
-    FPM->add(createInstructionCombiningPass(true));
-    FPM->add(createCFGSimplificationPass());
-    FPM->add(createSROAPass());
-    FPM->add(createEarlyCSEPass(true));
-    FPM->add(createSpeculativeExecutionIfHasBranchDivergencePass());
-    FPM->add(createJumpThreadingPass());
-    FPM->add(createCorrelatedValuePropagationPass());
-    FPM->add(createCFGSimplificationPass());
-    FPM->add(createInstructionCombiningPass(true));
-    FPM->add(createLibCallsShrinkWrapPass());
-    FPM->add(createTailCallEliminationPass());
-    FPM->add(createCFGSimplificationPass());
-    FPM->add(createReassociatePass());
-    FPM->add(createLoopRotatePass(-1));
-    FPM->add(createGVNPass());
-    FPM->add(createLICMPass());
-    FPM->add(createSimpleLoopUnswitchLegacyPass());
-    FPM->add(createCFGSimplificationPass());
-    FPM->add(createInstructionCombiningPass(true));
-    FPM->add(createIndVarSimplifyPass());
-    FPM->add(createCFGSimplificationPass());
-    FPM->add(createSimpleLoopUnrollPass(3));
-    FPM->add(createMergedLoadStoreMotionPass());
-    FPM->add(createGVNPass());
-    FPM->add(createMemCpyOptPass());
-    FPM->add(createSCCPPass());
-    FPM->add(createBitTrackingDCEPass());
-    FPM->add(createInstructionCombiningPass(true));
-    FPM->add(createJumpThreadingPass());
-    FPM->add(createCorrelatedValuePropagationPass());
-    FPM->add(createDeadStoreEliminationPass());
-    FPM->add(createLICMPass());
-    FPM->add(createAggressiveDCEPass());
-    FPM->add(createCFGSimplificationPass());
-    FPM->add(createInstructionCombiningPass(true));
-    FPM->add(createFloat2IntPass());
-
-    return FPM->doInitialization();
-  }
-
-  bool doFinalization(Module &M) override {
-    bool Result = FPM->doFinalization();
-
-    delete FPM;
-    FPM = nullptr;
-
-    return Result;
-  }
-
-  bool runOnFunction(llvm::Function &F) override {
-    if (!F.hasFnAttribute("polly-optimized")) {
-      LLVM_DEBUG(
-          dbgs() << F.getName()
-                 << ": Skipping cleanup because Polly did not optimize it.");
-      return false;
-    }
-
-    LLVM_DEBUG(dbgs() << F.getName() << ": Running codegen cleanup...");
-    return FPM->run(F);
-  }
-  //@}
-};
-
-char CodegenCleanup::ID;
-} // namespace
-
-FunctionPass *polly::createCodegenCleanupPass() { return new CodegenCleanup(); }
-
-INITIALIZE_PASS_BEGIN(CodegenCleanup, "polly-cleanup",
-                      "Polly - Cleanup after code generation", false, false)
-INITIALIZE_PASS_END(CodegenCleanup, "polly-cleanup",
-                    "Polly - Cleanup after code generation", false, false)

diff  --git a/polly/lib/Support/RegisterPasses.cpp b/polly/lib/Support/RegisterPasses.cpp
index 52ffa5feb523d..a00c962f295e2 100644
--- a/polly/lib/Support/RegisterPasses.cpp
+++ b/polly/lib/Support/RegisterPasses.cpp
@@ -21,7 +21,6 @@
 #include "polly/RegisterPasses.h"
 #include "polly/Canonicalization.h"
 #include "polly/CodeGen/CodeGeneration.h"
-#include "polly/CodeGen/CodegenCleanup.h"
 #include "polly/CodeGen/IslAst.h"
 #include "polly/CodePreparation.h"
 #include "polly/DeLICM.h"
@@ -251,7 +250,6 @@ void initializePollyPasses(llvm::PassRegistry &Registry) {
   initializeScopInfoPrinterLegacyRegionPassPass(Registry);
   initializeScopInfoWrapperPassPass(Registry);
   initializeScopInfoPrinterLegacyFunctionPassPass(Registry);
-  initializeCodegenCleanupPass(Registry);
   initializeFlattenSchedulePass(Registry);
   initializeFlattenSchedulePrinterLegacyPassPass(Registry);
   initializeForwardOpTreeWrapperPassPass(Registry);


        


More information about the llvm-commits mailing list