[llvm] 2c2c968 - [OpenMP][LegacyPM] Remove OpenMPOptCGSCCLegacyPass
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 17:21:16 PST 2022
Author: LiaoChunyu
Date: 2022-12-01T09:21:10+08:00
New Revision: 2c2c9688f01799f17627ad10f7cfa544b8208c72
URL: https://github.com/llvm/llvm-project/commit/2c2c9688f01799f17627ad10f7cfa544b8208c72
DIFF: https://github.com/llvm/llvm-project/commit/2c2c9688f01799f17627ad10f7cfa544b8208c72.diff
LOG: [OpenMP][LegacyPM] Remove OpenMPOptCGSCCLegacyPass
Using the legacy pass manager for the optimization pipeline is deprecated.
I see the new PM is available.
Reviewed By: aeubanks, jdoerfert
Differential Revision: https://reviews.llvm.org/D139004
Added:
Modified:
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/IPO.h
llvm/lib/Transforms/IPO/IPO.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/test/Transforms/OpenMP/add_attributes.ll
llvm/test/Transforms/OpenMP/add_attributes_amdgcn.ll
llvm/test/Transforms/OpenMP/attributor_module_slice_reproducer.ll
llvm/test/Transforms/OpenMP/barrier_removal.ll
llvm/test/Transforms/OpenMP/dead_use.ll
llvm/test/Transforms/OpenMP/deduplication.ll
llvm/test/Transforms/OpenMP/deduplication_remarks.ll
llvm/test/Transforms/OpenMP/deduplication_target.ll
llvm/test/Transforms/OpenMP/gpu_kernel_detection_remarks.ll
llvm/test/Transforms/OpenMP/icv_remarks.ll
llvm/test/Transforms/OpenMP/icv_tracking_out_of_scope.ll
llvm/test/Transforms/OpenMP/parallel_deletion.ll
llvm/test/Transforms/OpenMP/parallel_deletion_remarks.ll
llvm/test/Transforms/OpenMP/remove_noinline_attributes.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 2e6b497d06930..fc24ae2de2cde 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -59,7 +59,6 @@ void initializeAssumeSimplifyPassLegacyPassPass(PassRegistry &);
void initializeAssumeBuilderPassLegacyPassPass(PassRegistry &);
void initializeAnnotation2MetadataLegacyPass(PassRegistry &);
void initializeAnnotationRemarksLegacyPass(PassRegistry &);
-void initializeOpenMPOptCGSCCLegacyPassPass(PassRegistry &);
void initializeAssumptionCacheTrackerPass(PassRegistry&);
void initializeAtomicExpandPass(PassRegistry&);
void initializeAttributorLegacyPassPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 73c3074d2a51d..56cea7d360a9c 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -72,8 +72,7 @@ namespace {
(void) llvm::createAAEvalPass();
(void) llvm::createAggressiveDCEPass();
- (void) llvm::createBitTrackingDCEPass();
- (void)llvm::createOpenMPOptCGSCCLegacyPass();
+ (void)llvm::createBitTrackingDCEPass();
(void) llvm::createAlignmentFromAssumptionsPass();
(void) llvm::createBasicAAWrapperPass();
(void) llvm::createSCEVAAWrapperPass();
diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h
index 8853a64ba4d1a..c979c41d74b7f 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -139,10 +139,6 @@ ModulePass *createDeadArgEliminationPass();
/// bugpoint.
ModulePass *createDeadArgHackingPass();
-//===----------------------------------------------------------------------===//
-/// createOpenMPOptLegacyPass - OpenMP specific optimizations.
-Pass *createOpenMPOptCGSCCLegacyPass();
-
//===----------------------------------------------------------------------===//
/// createIPSCCPPass - This pass propagates constants from call sites into the
/// bodies of functions, and keeps track of whether basic blocks are executable
diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp
index c5032416870b1..cad6a2650f09e 100644
--- a/llvm/lib/Transforms/IPO/IPO.cpp
+++ b/llvm/lib/Transforms/IPO/IPO.cpp
@@ -23,7 +23,6 @@
using namespace llvm;
void llvm::initializeIPO(PassRegistry &Registry) {
- initializeOpenMPOptCGSCCLegacyPassPass(Registry);
initializeAnnotation2MetadataLegacyPass(Registry);
initializeCalledValuePropagationLegacyPassPass(Registry);
initializeConstantMergeLegacyPassPass(Registry);
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index d1b9590226f4c..9181ce541a12b 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -45,7 +45,6 @@
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/Attributor.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/CallGraphUpdater.h"
@@ -5153,87 +5152,6 @@ PreservedAnalyses OpenMPOptCGSCCPass::run(LazyCallGraph::SCC &C,
return PreservedAnalyses::all();
}
-namespace {
-
-struct OpenMPOptCGSCCLegacyPass : public CallGraphSCCPass {
- CallGraphUpdater CGUpdater;
- static char ID;
-
- OpenMPOptCGSCCLegacyPass() : CallGraphSCCPass(ID) {
- initializeOpenMPOptCGSCCLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- CallGraphSCCPass::getAnalysisUsage(AU);
- }
-
- bool runOnSCC(CallGraphSCC &CGSCC) override {
- if (!containsOpenMP(CGSCC.getCallGraph().getModule()))
- return false;
- if (DisableOpenMPOptimizations || skipSCC(CGSCC))
- return false;
-
- SmallVector<Function *, 16> SCC;
- // If there are kernels in the module, we have to run on all SCC's.
- for (CallGraphNode *CGN : CGSCC) {
- Function *Fn = CGN->getFunction();
- if (!Fn || Fn->isDeclaration())
- continue;
- SCC.push_back(Fn);
- }
-
- if (SCC.empty())
- return false;
-
- Module &M = CGSCC.getCallGraph().getModule();
- KernelSet Kernels = getDeviceKernels(M);
-
- CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
- CGUpdater.initialize(CG, CGSCC);
-
- // Maintain a map of functions to avoid rebuilding the ORE
- DenseMap<Function *, std::unique_ptr<OptimizationRemarkEmitter>> OREMap;
- auto OREGetter = [&OREMap](Function *F) -> OptimizationRemarkEmitter & {
- std::unique_ptr<OptimizationRemarkEmitter> &ORE = OREMap[F];
- if (!ORE)
- ORE = std::make_unique<OptimizationRemarkEmitter>(F);
- return *ORE;
- };
-
- AnalysisGetter AG;
- SetVector<Function *> Functions(SCC.begin(), SCC.end());
- BumpPtrAllocator Allocator;
- OMPInformationCache InfoCache(*(Functions.back()->getParent()), AG,
- Allocator,
- /*CGSCC*/ &Functions, Kernels);
-
- unsigned MaxFixpointIterations =
- (isOpenMPDevice(M)) ? SetFixpointIterations : 32;
-
- AttributorConfig AC(CGUpdater);
- AC.DefaultInitializeLiveInternals = false;
- AC.IsModulePass = false;
- AC.RewriteSignatures = false;
- AC.MaxFixpointIterations = MaxFixpointIterations;
- AC.OREGetter = OREGetter;
- AC.PassName = DEBUG_TYPE;
-
- Attributor A(Functions, InfoCache, AC);
-
- OpenMPOpt OMPOpt(SCC, CGUpdater, OREGetter, InfoCache, A);
- bool Result = OMPOpt.run(false);
-
- if (PrintModuleAfterOptimizations)
- LLVM_DEBUG(dbgs() << TAG << "Module after OpenMPOpt CGSCC Pass:\n" << M);
-
- return Result;
- }
-
- bool doFinalization(CallGraph &CG) override { return CGUpdater.finalize(); }
-};
-
-} // end anonymous namespace
-
KernelSet llvm::omp::getDeviceKernels(Module &M) {
// TODO: Create a more cross-platform way of determining device kernels.
NamedMDNode *MD = M.getOrInsertNamedMetadata("nvvm.annotations");
@@ -5277,15 +5195,3 @@ bool llvm::omp::isOpenMPDevice(Module &M) {
return true;
}
-
-char OpenMPOptCGSCCLegacyPass::ID = 0;
-
-INITIALIZE_PASS_BEGIN(OpenMPOptCGSCCLegacyPass, "openmp-opt-cgscc",
- "OpenMP specific optimizations", false, false)
-INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
-INITIALIZE_PASS_END(OpenMPOptCGSCCLegacyPass, "openmp-opt-cgscc",
- "OpenMP specific optimizations", false, false)
-
-Pass *llvm::createOpenMPOptCGSCCLegacyPass() {
- return new OpenMPOptCGSCCLegacyPass();
-}
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index ad98ef6ae6638..dc18b2bc63ba4 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -355,11 +355,6 @@ void PassManagerBuilder::populateModulePassManager(
RunInliner = true;
}
- // Try to perform OpenMP specific optimizations. This is a (quick!) no-op if
- // there are no OpenMP runtime calls present in the module.
- if (OptLevel > 1)
- MPM.add(createOpenMPOptCGSCCLegacyPass());
-
MPM.add(createPostOrderFunctionAttrsLegacyPass());
addFunctionSimplificationPasses(MPM);
diff --git a/llvm/test/Transforms/OpenMP/add_attributes.ll b/llvm/test/Transforms/OpenMP/add_attributes.ll
index 7ad863c38ef07..c529408366d84 100644
--- a/llvm/test/Transforms/OpenMP/add_attributes.ll
+++ b/llvm/test/Transforms/OpenMP/add_attributes.ll
@@ -1,6 +1,4 @@
-; RUN: opt < %s -S -openmp-opt-cgscc | FileCheck %s
; RUN: opt < %s -S -passes=openmp-opt-cgscc | FileCheck %s
-; RUN: opt < %s -S -openmp-opt-cgscc -openmp-ir-builder-optimistic-attributes | FileCheck %s --check-prefix=OPTIMISTIC
; RUN: opt < %s -S -passes=openmp-opt-cgscc -openmp-ir-builder-optimistic-attributes | FileCheck %s --check-prefix=OPTIMISTIC
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/Transforms/OpenMP/add_attributes_amdgcn.ll b/llvm/test/Transforms/OpenMP/add_attributes_amdgcn.ll
index 93214dfd09790..db4cb4ecb4c4c 100644
--- a/llvm/test/Transforms/OpenMP/add_attributes_amdgcn.ll
+++ b/llvm/test/Transforms/OpenMP/add_attributes_amdgcn.ll
@@ -1,6 +1,4 @@
-; RUN: opt < %s -S -openmp-opt-cgscc | FileCheck %s
; RUN: opt < %s -S -passes=openmp-opt-cgscc | FileCheck %s
-; RUN: opt < %s -S -openmp-opt-cgscc -openmp-ir-builder-optimistic-attributes | FileCheck %s --check-prefix=OPTIMISTIC
; RUN: opt < %s -S -passes=openmp-opt-cgscc -openmp-ir-builder-optimistic-attributes | FileCheck %s --check-prefix=OPTIMISTIC
target triple = "amdgcn-amd-amdhsa"
diff --git a/llvm/test/Transforms/OpenMP/attributor_module_slice_reproducer.ll b/llvm/test/Transforms/OpenMP/attributor_module_slice_reproducer.ll
index 2b415d96e6611..86772ae8bd54d 100644
--- a/llvm/test/Transforms/OpenMP/attributor_module_slice_reproducer.ll
+++ b/llvm/test/Transforms/OpenMP/attributor_module_slice_reproducer.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
-; RUN: opt -S -openmp-opt-cgscc < %s | FileCheck %s
; RUN: opt -S -passes=openmp-opt-cgscc < %s | FileCheck %s
define internal fastcc void @"_omp$reduction$reduction_func14"() unnamed_addr {
diff --git a/llvm/test/Transforms/OpenMP/barrier_removal.ll b/llvm/test/Transforms/OpenMP/barrier_removal.ll
index 9b9778c49b624..2ed04de635c4c 100644
--- a/llvm/test/Transforms/OpenMP/barrier_removal.ll
+++ b/llvm/test/Transforms/OpenMP/barrier_removal.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
-; RUN: opt < %s -S -openmp-opt-cgscc | FileCheck %s
; RUN: opt < %s -S -passes=openmp-opt-cgscc | FileCheck %s
declare void @useI32(i32)
diff --git a/llvm/test/Transforms/OpenMP/dead_use.ll b/llvm/test/Transforms/OpenMP/dead_use.ll
index 32ae3684dc3b7..c116b620b8f07 100644
--- a/llvm/test/Transforms/OpenMP/dead_use.ll
+++ b/llvm/test/Transforms/OpenMP/dead_use.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
-; RUN: opt -S -openmp-opt-cgscc < %s | FileCheck %s
; RUN: opt -S -passes=openmp-opt-cgscc < %s | FileCheck %s
%struct.ident_t = type { i32, i32, i32, i32, i8* }
diff --git a/llvm/test/Transforms/OpenMP/deduplication.ll b/llvm/test/Transforms/OpenMP/deduplication.ll
index 9228fa052e375..070b027ae4ccb 100644
--- a/llvm/test/Transforms/OpenMP/deduplication.ll
+++ b/llvm/test/Transforms/OpenMP/deduplication.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
-; RUN: opt -openmp-opt-cgscc -S < %s | FileCheck %s
; RUN: opt -passes=openmp-opt-cgscc -S < %s | FileCheck %s
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/Transforms/OpenMP/deduplication_remarks.ll b/llvm/test/Transforms/OpenMP/deduplication_remarks.ll
index 836d7d2548121..a97f4da66f04f 100644
--- a/llvm/test/Transforms/OpenMP/deduplication_remarks.ll
+++ b/llvm/test/Transforms/OpenMP/deduplication_remarks.ll
@@ -1,4 +1,3 @@
-; RUN: opt -openmp-opt-cgscc -pass-remarks=openmp-opt -disable-output < %s 2>&1 | FileCheck %s
; RUN: opt -passes=openmp-opt-cgscc -pass-remarks=openmp-opt -disable-output < %s 2>&1 | FileCheck %s
; ModuleID = 'deduplication_remarks.c'
source_filename = "deduplication_remarks.c"
diff --git a/llvm/test/Transforms/OpenMP/deduplication_target.ll b/llvm/test/Transforms/OpenMP/deduplication_target.ll
index 64ec1a688bfff..213dae63ceace 100644
--- a/llvm/test/Transforms/OpenMP/deduplication_target.ll
+++ b/llvm/test/Transforms/OpenMP/deduplication_target.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
-; RUN: opt -openmp-opt-cgscc -S < %s | FileCheck %s
; RUN: opt -passes=openmp-opt-cgscc -S < %s | FileCheck %s
target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
diff --git a/llvm/test/Transforms/OpenMP/gpu_kernel_detection_remarks.ll b/llvm/test/Transforms/OpenMP/gpu_kernel_detection_remarks.ll
index 5cbd37e7d67de..aa578a2bd7117 100644
--- a/llvm/test/Transforms/OpenMP/gpu_kernel_detection_remarks.ll
+++ b/llvm/test/Transforms/OpenMP/gpu_kernel_detection_remarks.ll
@@ -1,5 +1,4 @@
; RUN: opt -passes=openmp-opt-cgscc -pass-remarks-analysis=openmp-opt -openmp-print-gpu-kernels -disable-output < %s 2>&1 | FileCheck %s --implicit-check-not=non_kernel
-; RUN: opt -openmp-opt-cgscc -pass-remarks-analysis=openmp-opt -openmp-print-gpu-kernels -disable-output < %s 2>&1 | FileCheck %s --implicit-check-not=non_kernel
; CHECK-DAG: remark: <unknown>:0:0: OpenMP GPU kernel kernel1
; CHECK-DAG: remark: <unknown>:0:0: OpenMP GPU kernel kernel2
diff --git a/llvm/test/Transforms/OpenMP/icv_remarks.ll b/llvm/test/Transforms/OpenMP/icv_remarks.ll
index ac655bf6f68cf..325686814540f 100644
--- a/llvm/test/Transforms/OpenMP/icv_remarks.ll
+++ b/llvm/test/Transforms/OpenMP/icv_remarks.ll
@@ -1,5 +1,5 @@
; RUN: opt -passes=openmp-opt-cgscc -pass-remarks-analysis=openmp-opt -openmp-print-icv-values -disable-output < %s 2>&1 | FileCheck %s
-; RUN: opt -openmp-opt-cgscc -pass-remarks-analysis=openmp-opt -openmp-print-icv-values -disable-output < %s 2>&1 | FileCheck %s
+; RUN: opt -passes=openmp-opt-cgscc -pass-remarks-analysis=openmp-opt -openmp-print-icv-values -disable-output < %s 2>&1 | FileCheck %s
; ModuleID = 'icv_remarks.c'
source_filename = "icv_remarks.c"
diff --git a/llvm/test/Transforms/OpenMP/icv_tracking_out_of_scope.ll b/llvm/test/Transforms/OpenMP/icv_tracking_out_of_scope.ll
index 00e4574dbba8e..b9889f9ba3017 100644
--- a/llvm/test/Transforms/OpenMP/icv_tracking_out_of_scope.ll
+++ b/llvm/test/Transforms/OpenMP/icv_tracking_out_of_scope.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
-; RUN: opt -S -openmp-opt-cgscc < %s | FileCheck %s
; RUN: opt -S -passes=openmp-opt-cgscc < %s | FileCheck %s
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/Transforms/OpenMP/parallel_deletion.ll b/llvm/test/Transforms/OpenMP/parallel_deletion.ll
index 108499631d196..908224082097d 100644
--- a/llvm/test/Transforms/OpenMP/parallel_deletion.ll
+++ b/llvm/test/Transforms/OpenMP/parallel_deletion.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
-; RUN: opt -S -attributor -openmp-opt-cgscc < %s | FileCheck %s
; RUN: opt -S -passes='attributor,cgscc(openmp-opt-cgscc)' < %s | FileCheck %s
;
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/Transforms/OpenMP/parallel_deletion_remarks.ll b/llvm/test/Transforms/OpenMP/parallel_deletion_remarks.ll
index 9d997606ce036..54f27637d9ecd 100644
--- a/llvm/test/Transforms/OpenMP/parallel_deletion_remarks.ll
+++ b/llvm/test/Transforms/OpenMP/parallel_deletion_remarks.ll
@@ -1,4 +1,3 @@
-; RUN: opt -S -pass-remarks=openmp-opt -attributor -openmp-opt-cgscc -disable-output < %s 2>&1 | FileCheck %s
; RUN: opt -S -pass-remarks=openmp-opt -passes='attributor,cgscc(openmp-opt-cgscc)' -disable-output < %s 2>&1 | FileCheck %s
; ModuleID = 'parallel_deletion_remarks.ll'
source_filename = "parallel_deletion_remarks.c"
diff --git a/llvm/test/Transforms/OpenMP/remove_noinline_attributes.ll b/llvm/test/Transforms/OpenMP/remove_noinline_attributes.ll
index 349e2799de27a..211c28121a965 100644
--- a/llvm/test/Transforms/OpenMP/remove_noinline_attributes.ll
+++ b/llvm/test/Transforms/OpenMP/remove_noinline_attributes.ll
@@ -1,5 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes
-; RUN: opt < %s -S -openmp-opt-cgscc | FileCheck %s
; RUN: opt < %s -S -passes=openmp-opt-cgscc | FileCheck %s
declare void @unknown()
More information about the llvm-commits
mailing list