From 896f064a4900458e3fb245ad3f6fc9e7a3d8c8cd Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 18 Aug 2015 17:51:53 +0000 Subject: [PATCH] [PM/AA] Remove the last relics of the separate IPA library from LLVM, folding the code into the main Analysis library. There already wasn't much of a distinction between Analysis and IPA. A number of the passes in Analysis are actually IPA passes, and there doesn't seem to be any advantage to separating them. Moreover, it makes it hard to have interactions between analyses that are both local and interprocedural. In trying to make the Alias Analysis infrastructure work with the new pass manager, it becomes particularly awkward to navigate this split. I've tried to find all the places where we referenced this, but I may have missed some. I have also adjusted the C API to continue to be equivalently functional after this change. Differential Revision: http://reviews.llvm.org/D12075 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245318 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/python/llvm/core.py | 4 --- include/llvm/InitializePasses.h | 3 --- lib/Analysis/Analysis.cpp | 8 ++++++ lib/Analysis/CMakeLists.txt | 7 +++-- lib/Analysis/{IPA => }/CallGraph.cpp | 0 lib/Analysis/{IPA => }/CallGraphSCCPass.cpp | 0 lib/Analysis/{IPA => }/CallPrinter.cpp | 0 lib/Analysis/{IPA => }/GlobalsModRef.cpp | 0 lib/Analysis/IPA/CMakeLists.txt | 10 ------- lib/Analysis/IPA/IPA.cpp | 30 --------------------- lib/Analysis/IPA/LLVMBuild.txt | 23 ---------------- lib/Analysis/IPA/Makefile | 15 ----------- lib/Analysis/{IPA => }/InlineCost.cpp | 0 lib/Analysis/LLVMBuild.txt | 3 --- lib/Analysis/Makefile | 1 - lib/LTO/LLVMBuild.txt | 1 - lib/Passes/LLVMBuild.txt | 2 +- lib/Transforms/IPO/LLVMBuild.txt | 2 +- lib/Transforms/Utils/LLVMBuild.txt | 2 +- tools/bugpoint/CMakeLists.txt | 1 - tools/bugpoint/bugpoint.cpp | 1 - tools/llvm-shlib/CMakeLists.txt | 1 - tools/llvm-stress/CMakeLists.txt | 2 +- tools/opt/CMakeLists.txt | 1 - tools/opt/opt.cpp | 1 - unittests/Analysis/CMakeLists.txt | 1 - unittests/Analysis/Makefile | 2 +- unittests/IR/CMakeLists.txt | 1 - unittests/IR/Makefile | 2 +- 29 files changed, 19 insertions(+), 105 deletions(-) rename lib/Analysis/{IPA => }/CallGraph.cpp (100%) rename lib/Analysis/{IPA => }/CallGraphSCCPass.cpp (100%) rename lib/Analysis/{IPA => }/CallPrinter.cpp (100%) rename lib/Analysis/{IPA => }/GlobalsModRef.cpp (100%) delete mode 100644 lib/Analysis/IPA/CMakeLists.txt delete mode 100644 lib/Analysis/IPA/IPA.cpp delete mode 100644 lib/Analysis/IPA/LLVMBuild.txt delete mode 100644 lib/Analysis/IPA/Makefile rename lib/Analysis/{IPA => }/InlineCost.cpp (100%) diff --git a/bindings/python/llvm/core.py b/bindings/python/llvm/core.py index c95952db6fc..47e81dd1a4f 100644 --- a/bindings/python/llvm/core.py +++ b/bindings/python/llvm/core.py @@ -465,9 +465,6 @@ def register_library(library): library.LLVMInitializeAnalysis.argtypes = [PassRegistry] library.LLVMInitializeAnalysis.restype = None - library.LLVMInitializeIPA.argtypes = [PassRegistry] - library.LLVMInitializeIPA.restype = None - library.LLVMInitializeCodeGen.argtypes = [PassRegistry] library.LLVMInitializeCodeGen.restype = None @@ -621,7 +618,6 @@ def initialize_llvm(): lib.LLVMInitializeIPO(p) lib.LLVMInitializeInstrumentation(p) lib.LLVMInitializeAnalysis(p) - lib.LLVMInitializeIPA(p) lib.LLVMInitializeCodeGen(p) lib.LLVMInitializeTarget(p) diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h index 48776110f5f..90d444a3160 100644 --- a/include/llvm/InitializePasses.h +++ b/include/llvm/InitializePasses.h @@ -53,9 +53,6 @@ void initializeInstrumentation(PassRegistry&); /// initializeAnalysis - Initialize all passes linked into the Analysis library. void initializeAnalysis(PassRegistry&); -/// initializeIPA - Initialize all passes linked into the IPA library. -void initializeIPA(PassRegistry&); - /// initializeCodeGen - Initialize all passes linked into the CodeGen library. void initializeCodeGen(PassRegistry&); diff --git a/lib/Analysis/Analysis.cpp b/lib/Analysis/Analysis.cpp index 91e7339337a..ac1cf763a6a 100644 --- a/lib/Analysis/Analysis.cpp +++ b/lib/Analysis/Analysis.cpp @@ -28,6 +28,9 @@ void llvm::initializeAnalysis(PassRegistry &Registry) { initializeBasicAliasAnalysisPass(Registry); initializeBlockFrequencyInfoWrapperPassPass(Registry); initializeBranchProbabilityInfoWrapperPassPass(Registry); + initializeCallGraphWrapperPassPass(Registry); + initializeCallGraphPrinterPass(Registry); + initializeCallGraphViewerPass(Registry); initializeCostModelAnalysisPass(Registry); initializeCFGViewerPass(Registry); initializeCFGPrinterPass(Registry); @@ -47,6 +50,7 @@ void llvm::initializeAnalysis(PassRegistry &Registry) { initializePostDomPrinterPass(Registry); initializePostDomOnlyViewerPass(Registry); initializePostDomOnlyPrinterPass(Registry); + initializeGlobalsModRefPass(Registry); initializeIVUsersPass(Registry); initializeInstCountPass(Registry); initializeIntervalPartitionPass(Registry); @@ -74,6 +78,10 @@ void LLVMInitializeAnalysis(LLVMPassRegistryRef R) { initializeAnalysis(*unwrap(R)); } +void LLVMInitializeIPA(LLVMPassRegistryRef R) { + initializeAnalysis(*unwrap(R)); +} + LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action, char **OutMessages) { raw_ostream *DebugOS = Action != LLVMReturnStatusAction ? &errs() : nullptr; diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt index 16417b610cb..599f48d46b4 100644 --- a/lib/Analysis/CMakeLists.txt +++ b/lib/Analysis/CMakeLists.txt @@ -13,6 +13,9 @@ add_llvm_library(LLVMAnalysis CFGPrinter.cpp CFLAliasAnalysis.cpp CGSCCPassManager.cpp + CallGraph.cpp + CallGraphSCCPass.cpp + CallPrinter.cpp CaptureTracking.cpp CostModel.cpp CodeMetrics.cpp @@ -23,7 +26,9 @@ add_llvm_library(LLVMAnalysis DivergenceAnalysis.cpp DomPrinter.cpp DominanceFrontier.cpp + GlobalsModRef.cpp IVUsers.cpp + InlineCost.cpp InstCount.cpp InstructionSimplify.cpp Interval.cpp @@ -69,5 +74,3 @@ add_llvm_library(LLVMAnalysis ) add_dependencies(LLVMAnalysis intrinsics_gen) - -add_subdirectory(IPA) diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/CallGraph.cpp similarity index 100% rename from lib/Analysis/IPA/CallGraph.cpp rename to lib/Analysis/CallGraph.cpp diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/CallGraphSCCPass.cpp similarity index 100% rename from lib/Analysis/IPA/CallGraphSCCPass.cpp rename to lib/Analysis/CallGraphSCCPass.cpp diff --git a/lib/Analysis/IPA/CallPrinter.cpp b/lib/Analysis/CallPrinter.cpp similarity index 100% rename from lib/Analysis/IPA/CallPrinter.cpp rename to lib/Analysis/CallPrinter.cpp diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/GlobalsModRef.cpp similarity index 100% rename from lib/Analysis/IPA/GlobalsModRef.cpp rename to lib/Analysis/GlobalsModRef.cpp diff --git a/lib/Analysis/IPA/CMakeLists.txt b/lib/Analysis/IPA/CMakeLists.txt deleted file mode 100644 index 6095136d60a..00000000000 --- a/lib/Analysis/IPA/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_llvm_library(LLVMipa - CallGraph.cpp - CallGraphSCCPass.cpp - CallPrinter.cpp - GlobalsModRef.cpp - IPA.cpp - InlineCost.cpp - ) - -add_dependencies(LLVMipa intrinsics_gen) diff --git a/lib/Analysis/IPA/IPA.cpp b/lib/Analysis/IPA/IPA.cpp deleted file mode 100644 index 806bfb81b6d..00000000000 --- a/lib/Analysis/IPA/IPA.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===-- IPA.cpp -----------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the common initialization routines for the IPA library. -// -//===----------------------------------------------------------------------===// - -#include "llvm/InitializePasses.h" -#include "llvm-c/Initialization.h" -#include "llvm/PassRegistry.h" - -using namespace llvm; - -/// initializeIPA - Initialize all passes linked into the IPA library. -void llvm::initializeIPA(PassRegistry &Registry) { - initializeCallGraphWrapperPassPass(Registry); - initializeCallGraphPrinterPass(Registry); - initializeCallGraphViewerPass(Registry); - initializeGlobalsModRefPass(Registry); -} - -void LLVMInitializeIPA(LLVMPassRegistryRef R) { - initializeIPA(*unwrap(R)); -} diff --git a/lib/Analysis/IPA/LLVMBuild.txt b/lib/Analysis/IPA/LLVMBuild.txt deleted file mode 100644 index 980e91809b5..00000000000 --- a/lib/Analysis/IPA/LLVMBuild.txt +++ /dev/null @@ -1,23 +0,0 @@ -;===- ./lib/Analysis/IPA/LLVMBuild.txt -------------------------*- Conf -*--===; -; -; The LLVM Compiler Infrastructure -; -; This file is distributed under the University of Illinois Open Source -; License. See LICENSE.TXT for details. -; -;===------------------------------------------------------------------------===; -; -; This is an LLVMBuild description file for the components in this subdirectory. -; -; For more information on the LLVMBuild system, please see: -; -; http://llvm.org/docs/LLVMBuild.html -; -;===------------------------------------------------------------------------===; - -[component_0] -type = Library -name = IPA -parent = Libraries -library_name = ipa -required_libraries = Analysis Core Support diff --git a/lib/Analysis/IPA/Makefile b/lib/Analysis/IPA/Makefile deleted file mode 100644 index b850c9ff7f4..00000000000 --- a/lib/Analysis/IPA/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -##===- lib/Analysis/IPA/Makefile ---------------------------*- Makefile -*-===## -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -##===----------------------------------------------------------------------===## - -LEVEL = ../../.. -LIBRARYNAME = LLVMipa -BUILD_ARCHIVE = 1 - -include $(LEVEL)/Makefile.common - diff --git a/lib/Analysis/IPA/InlineCost.cpp b/lib/Analysis/InlineCost.cpp similarity index 100% rename from lib/Analysis/IPA/InlineCost.cpp rename to lib/Analysis/InlineCost.cpp diff --git a/lib/Analysis/LLVMBuild.txt b/lib/Analysis/LLVMBuild.txt index 3039ddea4ff..bddf1a3ac20 100644 --- a/lib/Analysis/LLVMBuild.txt +++ b/lib/Analysis/LLVMBuild.txt @@ -15,9 +15,6 @@ ; ;===------------------------------------------------------------------------===; -[common] -subdirectories = IPA - [component_0] type = Library name = Analysis diff --git a/lib/Analysis/Makefile b/lib/Analysis/Makefile index 4af6d350a64..93fd7f9bdd9 100644 --- a/lib/Analysis/Makefile +++ b/lib/Analysis/Makefile @@ -9,7 +9,6 @@ LEVEL = ../.. LIBRARYNAME = LLVMAnalysis -DIRS = IPA BUILD_ARCHIVE = 1 include $(LEVEL)/Makefile.common diff --git a/lib/LTO/LLVMBuild.txt b/lib/LTO/LLVMBuild.txt index ea79d5e6a83..7a0ad50fb94 100644 --- a/lib/LTO/LLVMBuild.txt +++ b/lib/LTO/LLVMBuild.txt @@ -25,7 +25,6 @@ required_libraries = BitWriter CodeGen Core - IPA IPO InstCombine Linker diff --git a/lib/Passes/LLVMBuild.txt b/lib/Passes/LLVMBuild.txt index 3063fe3e5da..a752f42dced 100644 --- a/lib/Passes/LLVMBuild.txt +++ b/lib/Passes/LLVMBuild.txt @@ -19,4 +19,4 @@ type = Library name = Passes parent = Libraries -required_libraries = Analysis Core IPA IPO InstCombine Scalar Support TransformUtils Vectorize +required_libraries = Analysis Core IPO InstCombine Scalar Support TransformUtils Vectorize diff --git a/lib/Transforms/IPO/LLVMBuild.txt b/lib/Transforms/IPO/LLVMBuild.txt index 575dce4b33d..56723901702 100644 --- a/lib/Transforms/IPO/LLVMBuild.txt +++ b/lib/Transforms/IPO/LLVMBuild.txt @@ -20,4 +20,4 @@ type = Library name = IPO parent = Transforms library_name = ipo -required_libraries = Analysis Core IPA InstCombine Scalar Support TransformUtils Vectorize +required_libraries = Analysis Core InstCombine Scalar Support TransformUtils Vectorize diff --git a/lib/Transforms/Utils/LLVMBuild.txt b/lib/Transforms/Utils/LLVMBuild.txt index 6b2d405b1f2..ece0ad4dbf4 100644 --- a/lib/Transforms/Utils/LLVMBuild.txt +++ b/lib/Transforms/Utils/LLVMBuild.txt @@ -19,4 +19,4 @@ type = Library name = TransformUtils parent = Transforms -required_libraries = Analysis Core IPA Support +required_libraries = Analysis Core Support diff --git a/tools/bugpoint/CMakeLists.txt b/tools/bugpoint/CMakeLists.txt index daf502e16cc..287a26ecd40 100644 --- a/tools/bugpoint/CMakeLists.txt +++ b/tools/bugpoint/CMakeLists.txt @@ -3,7 +3,6 @@ set(LLVM_LINK_COMPONENTS BitWriter CodeGen Core - IPA IPO IRReader InstCombine diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index af6d9fccf29..ce3d936c819 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -126,7 +126,6 @@ int main(int argc, char **argv) { initializeVectorization(Registry); initializeIPO(Registry); initializeAnalysis(Registry); - initializeIPA(Registry); initializeTransformUtils(Registry); initializeInstCombine(Registry); initializeInstrumentation(Registry); diff --git a/tools/llvm-shlib/CMakeLists.txt b/tools/llvm-shlib/CMakeLists.txt index 54d71d3f632..9be8b436fe5 100644 --- a/tools/llvm-shlib/CMakeLists.txt +++ b/tools/llvm-shlib/CMakeLists.txt @@ -18,7 +18,6 @@ if(NOT DEFINED LLVM_DYLIB_COMPONENTS) DebugInfoDWARF DebugInfoPDB ExecutionEngine - IPA IPO IRReader InstCombine diff --git a/tools/llvm-stress/CMakeLists.txt b/tools/llvm-stress/CMakeLists.txt index d5c10e13f5b..8f2b30e4163 100644 --- a/tools/llvm-stress/CMakeLists.txt +++ b/tools/llvm-stress/CMakeLists.txt @@ -1,6 +1,6 @@ set(LLVM_LINK_COMPONENTS + Analysis Core - IPA Support ) diff --git a/tools/opt/CMakeLists.txt b/tools/opt/CMakeLists.txt index 5f825220cc8..9194a6ba098 100644 --- a/tools/opt/CMakeLists.txt +++ b/tools/opt/CMakeLists.txt @@ -4,7 +4,6 @@ set(LLVM_LINK_COMPONENTS BitWriter CodeGen Core - IPA IPO IRReader InstCombine diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 0db60d14440..5fe2f034c6e 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -312,7 +312,6 @@ int main(int argc, char **argv) { initializeVectorization(Registry); initializeIPO(Registry); initializeAnalysis(Registry); - initializeIPA(Registry); initializeTransformUtils(Registry); initializeInstCombine(Registry); initializeInstrumentation(Registry); diff --git a/unittests/Analysis/CMakeLists.txt b/unittests/Analysis/CMakeLists.txt index 28d35ceec92..06560cf14d4 100644 --- a/unittests/Analysis/CMakeLists.txt +++ b/unittests/Analysis/CMakeLists.txt @@ -1,5 +1,4 @@ set(LLVM_LINK_COMPONENTS - IPA Analysis AsmParser Core diff --git a/unittests/Analysis/Makefile b/unittests/Analysis/Makefile index 52296e7b3db..527f4525e87 100644 --- a/unittests/Analysis/Makefile +++ b/unittests/Analysis/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TESTNAME = Analysis -LINK_COMPONENTS := ipa analysis asmparser +LINK_COMPONENTS := analysis asmparser include $(LEVEL)/Makefile.config include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest diff --git a/unittests/IR/CMakeLists.txt b/unittests/IR/CMakeLists.txt index 0c2979632e1..e5a0fc98107 100644 --- a/unittests/IR/CMakeLists.txt +++ b/unittests/IR/CMakeLists.txt @@ -2,7 +2,6 @@ set(LLVM_LINK_COMPONENTS Analysis AsmParser Core - IPA Support ) diff --git a/unittests/IR/Makefile b/unittests/IR/Makefile index 7c59003c92a..45aa8d68082 100644 --- a/unittests/IR/Makefile +++ b/unittests/IR/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TESTNAME = IR -LINK_COMPONENTS := core ipa asmparser +LINK_COMPONENTS := core analysis asmparser include $(LEVEL)/Makefile.config include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest -- 2.34.1