From 384ca190ae7f32047aeba2a2f1d6a8637b597199 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Tue, 14 Apr 2020 00:27:08 +0000 Subject: [PATCH] Revert "Move ModuleSummaryAnalysis from libAnalysis to libObject to break the dependency from Analysis to Object" This reverts commit 10df1563d608323a3144afc5f6038ecb81869b92. Some buildbots are broken. --- .../{Object => Analysis}/ModuleSummaryAnalysis.h | 0 llvm/lib/Analysis/CMakeLists.txt | 1 + llvm/lib/Analysis/LLVMBuild.txt | 2 +- .../{Object => Analysis}/ModuleSummaryAnalysis.cpp | 31 +++++++++------------- llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp | 2 +- llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 2 +- llvm/lib/Object/CMakeLists.txt | 1 - llvm/lib/Passes/PassBuilder.cpp | 2 +- llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp | 2 +- 9 files changed, 19 insertions(+), 24 deletions(-) rename llvm/include/llvm/{Object => Analysis}/ModuleSummaryAnalysis.h (100%) rename llvm/lib/{Object => Analysis}/ModuleSummaryAnalysis.cpp (97%) diff --git a/llvm/include/llvm/Object/ModuleSummaryAnalysis.h b/llvm/include/llvm/Analysis/ModuleSummaryAnalysis.h similarity index 100% rename from llvm/include/llvm/Object/ModuleSummaryAnalysis.h rename to llvm/include/llvm/Analysis/ModuleSummaryAnalysis.h diff --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt index 5a20b83..dccd3d7 100644 --- a/llvm/lib/Analysis/CMakeLists.txt +++ b/llvm/lib/Analysis/CMakeLists.txt @@ -67,6 +67,7 @@ add_llvm_component_library(LLVMAnalysis MemorySSA.cpp MemorySSAUpdater.cpp ModuleDebugInfoPrinter.cpp + ModuleSummaryAnalysis.cpp MustExecute.cpp ObjCARCAliasAnalysis.cpp ObjCARCAnalysisUtils.cpp diff --git a/llvm/lib/Analysis/LLVMBuild.txt b/llvm/lib/Analysis/LLVMBuild.txt index b67dc4d..d73b55f 100644 --- a/llvm/lib/Analysis/LLVMBuild.txt +++ b/llvm/lib/Analysis/LLVMBuild.txt @@ -18,4 +18,4 @@ type = Library name = Analysis parent = Libraries -required_libraries = BinaryFormat Core ProfileData Support +required_libraries = BinaryFormat Core Object ProfileData Support diff --git a/llvm/lib/Object/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp similarity index 97% rename from llvm/lib/Object/ModuleSummaryAnalysis.cpp rename to llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 1c586a3..1ff47e1 100644 --- a/llvm/lib/Object/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -11,7 +11,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Object/ModuleSummaryAnalysis.h" +#include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/MapVector.h" @@ -327,8 +327,7 @@ static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, // Check if this is an alias to a function. If so, get the // called aliasee for the checks below. if (auto *GA = dyn_cast(CalledValue)) { - assert(!CalledFunction && - "Expected null called function in callsite for alias"); + assert(!CalledFunction && "Expected null called function in callsite for alias"); CalledFunction = dyn_cast(GA->getBaseObject()); } // Check if this is a direct call to a known function or a known @@ -461,8 +460,7 @@ static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, NonRenamableLocal || HasInlineAsmMaybeReferencingInternal; GlobalValueSummary::GVFlags Flags(F.getLinkage(), NotEligibleForImport, /* Live = */ false, F.isDSOLocal(), - F.hasLinkOnceODRLinkage() && - F.hasGlobalUnnamedAddr()); + F.hasLinkOnceODRLinkage() && F.hasGlobalUnnamedAddr()); FunctionSummary::FFlags FunFlags{ F.hasFnAttribute(Attribute::ReadNone), F.hasFnAttribute(Attribute::ReadOnly), @@ -580,8 +578,7 @@ static void computeVariableSummary(ModuleSummaryIndex &Index, bool NonRenamableLocal = isNonRenamableLocal(V); GlobalValueSummary::GVFlags Flags(V.getLinkage(), NonRenamableLocal, /* Live = */ false, V.isDSOLocal(), - V.hasLinkOnceODRLinkage() && - V.hasGlobalUnnamedAddr()); + V.hasLinkOnceODRLinkage() && V.hasGlobalUnnamedAddr()); VTableFuncList VTableFuncs; // If splitting is not enabled, then we compute the summary information @@ -607,7 +604,7 @@ static void computeVariableSummary(ModuleSummaryIndex &Index, Constant ? false : CanBeInternalized, Constant, V.getVCallVisibility()); auto GVarSummary = std::make_unique(Flags, VarFlags, - RefEdges.takeVector()); + RefEdges.takeVector()); if (NonRenamableLocal) CantBePromoted.insert(V.getGUID()); if (HasBlockAddress) @@ -617,13 +614,13 @@ static void computeVariableSummary(ModuleSummaryIndex &Index, Index.addGlobalValueSummary(V, std::move(GVarSummary)); } -static void computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A, - DenseSet &CantBePromoted) { +static void +computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A, + DenseSet &CantBePromoted) { bool NonRenamableLocal = isNonRenamableLocal(A); GlobalValueSummary::GVFlags Flags(A.getLinkage(), NonRenamableLocal, /* Live = */ false, A.isDSOLocal(), - A.hasLinkOnceODRLinkage() && - A.hasGlobalUnnamedAddr()); + A.hasLinkOnceODRLinkage() && A.hasGlobalUnnamedAddr()); auto AS = std::make_unique(Flags); auto *Aliasee = A.getBaseObject(); auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID()); @@ -694,14 +691,12 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex( GlobalValue *GV = M.getNamedValue(Name); if (!GV) return; - assert(GV->isDeclaration() && - "Def in module asm already has definition"); + assert(GV->isDeclaration() && "Def in module asm already has definition"); GlobalValueSummary::GVFlags GVFlags(GlobalValue::InternalLinkage, /* NotEligibleToImport = */ true, /* Live = */ true, /* Local */ GV->isDSOLocal(), - GV->hasLinkOnceODRLinkage() && - GV->hasGlobalUnnamedAddr()); + GV->hasLinkOnceODRLinkage() && GV->hasGlobalUnnamedAddr()); CantBePromoted.insert(GV->getGUID()); // Create the appropriate summary type. if (Function *F = dyn_cast(GV)) { @@ -839,8 +834,8 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex( AnalysisKey ModuleSummaryIndexAnalysis::Key; -ModuleSummaryIndex ModuleSummaryIndexAnalysis::run(Module &M, - ModuleAnalysisManager &AM) { +ModuleSummaryIndex +ModuleSummaryIndexAnalysis::run(Module &M, ModuleAnalysisManager &AM) { ProfileSummaryInfo &PSI = AM.getResult(M); auto &FAM = AM.getResult(M).getManager(); return buildModuleSummaryIndex( diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp index 1e9b349..d884415 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp @@ -11,11 +11,11 @@ //===----------------------------------------------------------------------===// #include "llvm/Bitcode/BitcodeWriterPass.h" +#include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Bitcode/BitcodeWriter.h" #include "llvm/IR/Module.h" #include "llvm/IR/PassManager.h" #include "llvm/InitializePasses.h" -#include "llvm/Object/ModuleSummaryAnalysis.h" #include "llvm/Pass.h" using namespace llvm; diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index d23ebe6..3d8d48d 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -16,6 +16,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" @@ -36,7 +37,6 @@ #include "llvm/LTO/SummaryBasedOptimizations.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Object/IRObjectFile.h" -#include "llvm/Object/ModuleSummaryAnalysis.h" #include "llvm/Support/CachePruning.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Error.h" diff --git a/llvm/lib/Object/CMakeLists.txt b/llvm/lib/Object/CMakeLists.txt index 1eeac73..61888cb 100644 --- a/llvm/lib/Object/CMakeLists.txt +++ b/llvm/lib/Object/CMakeLists.txt @@ -14,7 +14,6 @@ add_llvm_component_library(LLVMObject MachOObjectFile.cpp MachOUniversal.cpp Minidump.cpp - ModuleSummaryAnalysis.cpp ModuleSymbolTable.cpp Object.cpp ObjectFile.cpp diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index f0dd79a..9f60324 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -41,6 +41,7 @@ #include "llvm/Analysis/LoopNestAnalysis.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" #include "llvm/Analysis/MemorySSA.h" +#include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" #include "llvm/Analysis/PhiValues.h" #include "llvm/Analysis/PostDominators.h" @@ -61,7 +62,6 @@ #include "llvm/IR/PassManager.h" #include "llvm/IR/SafepointIRVerifier.h" #include "llvm/IR/Verifier.h" -#include "llvm/Object/ModuleSummaryAnalysis.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FormatVariadic.h" diff --git a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp index 6e1417a..87a1817 100644 --- a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp +++ b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp @@ -8,6 +8,7 @@ #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h" #include "llvm/Analysis/BasicAliasAnalysis.h" +#include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/Analysis/TypeMetadataUtils.h" #include "llvm/Bitcode/BitcodeWriter.h" @@ -17,7 +18,6 @@ #include "llvm/IR/Module.h" #include "llvm/IR/PassManager.h" #include "llvm/InitializePasses.h" -#include "llvm/Object/ModuleSummaryAnalysis.h" #include "llvm/Object/ModuleSymbolTable.h" #include "llvm/Pass.h" #include "llvm/Support/ScopedPrinter.h" -- 2.7.4