diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -59,7 +59,6 @@ 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 --- a/llvm/include/llvm/LinkAllPasses.h +++ b/llvm/include/llvm/LinkAllPasses.h @@ -73,7 +73,6 @@ (void) llvm::createAAEvalPass(); (void) llvm::createAggressiveDCEPass(); (void) llvm::createBitTrackingDCEPass(); - (void)llvm::createOpenMPOptCGSCCLegacyPass(); (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 --- a/llvm/include/llvm/Transforms/IPO.h +++ b/llvm/include/llvm/Transforms/IPO.h @@ -139,10 +139,6 @@ /// 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 --- 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 --- 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,86 +5152,6 @@ 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 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().getCallGraph(); - CGUpdater.initialize(CG, CGSCC); - - // Maintain a map of functions to avoid rebuilding the ORE - DenseMap> OREMap; - auto OREGetter = [&OREMap](Function *F) -> OptimizationRemarkEmitter & { - std::unique_ptr &ORE = OREMap[F]; - if (!ORE) - ORE = std::make_unique(F); - return *ORE; - }; - - AnalysisGetter AG; - SetVector 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. @@ -5277,15 +5196,3 @@ 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 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -355,11 +355,6 @@ 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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: :0:0: OpenMP GPU kernel kernel1 ; CHECK-DAG: remark: :0:0: OpenMP GPU kernel kernel2 diff --git a/llvm/test/Transforms/OpenMP/icv_remarks.ll b/llvm/test/Transforms/OpenMP/icv_remarks.ll --- 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 --- 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 --- 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 --- 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 --- 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()