From 452a14efc84edf808d1e2953dad2c694972b312f Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Tue, 15 Nov 2022 07:39:40 -0800 Subject: Revert "[MemProf] ThinLTO summary support" This reverts commit 47459455009db4790ffc3765a2ec0f8b4934c2a4. Revert while I try to fix a couple of non-Linux build failures. --- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 62 +---------------------------- 1 file changed, 2 insertions(+), 60 deletions(-) (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp') diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index e8309f5..52827c2 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -24,7 +24,6 @@ #include "llvm/Analysis/BranchProbabilityInfo.h" #include "llvm/Analysis/IndirectCallPromotionAnalysis.h" #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/MemoryProfileInfo.h" #include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/Analysis/StackSafetyAnalysis.h" #include "llvm/Analysis/TypeMetadataUtils.h" @@ -57,7 +56,6 @@ #include using namespace llvm; -using namespace llvm::memprof; #define DEBUG_TYPE "module-summary-analysis" @@ -277,9 +275,6 @@ static void computeFunctionSummary( std::vector NonVolatileLoads; std::vector NonVolatileStores; - std::vector Callsites; - std::vector Allocs; - bool HasInlineAsmMaybeReferencingInternal = false; bool HasIndirBranchToBlockAddress = false; bool HasUnknownCall = false; @@ -422,57 +417,6 @@ static void computeFunctionSummary( CallGraphEdges[Index.getOrInsertValueInfo(Candidate.Value)] .updateHotness(getHotness(Candidate.Count, PSI)); } - - // TODO: Skip indirect calls for now. Need to handle these better, likely - // by creating multiple Callsites, one per target, then speculatively - // devirtualize while applying clone info in the ThinLTO backends. This - // will also be important because we will have a different set of clone - // versions per target. This handling needs to match that in the ThinLTO - // backend so we handle things consistently for matching of callsite - // summaries to instructions. - if (!CalledFunction) - continue; - - // Compute the list of stack ids first (so we can trim them from the stack - // ids on any MIBs). - CallStack InstCallsite( - I.getMetadata(LLVMContext::MD_callsite)); - auto *MemProfMD = I.getMetadata(LLVMContext::MD_memprof); - if (MemProfMD) { - std::vector MIBs; - for (auto &MDOp : MemProfMD->operands()) { - auto *MIBMD = cast(MDOp); - MDNode *StackNode = getMIBStackNode(MIBMD); - assert(StackNode); - SmallVector StackIdIndices; - CallStack StackContext(StackNode); - // Collapse out any on the allocation call (inlining). - for (auto ContextIter = - StackContext.beginAfterSharedPrefix(InstCallsite); - ContextIter != StackContext.end(); ++ContextIter) { - unsigned StackIdIdx = Index.addOrGetStackIdIndex(*ContextIter); - // If this is a direct recursion, simply skip the duplicate - // entries. If this is mutual recursion, handling is left to - // the LTO link analysis client. - if (StackIdIndices.empty() || StackIdIndices.back() != StackIdIdx) - StackIdIndices.push_back(StackIdIdx); - } - MIBs.push_back( - MIBInfo(getMIBAllocType(MIBMD), std::move(StackIdIndices))); - } - Allocs.push_back(AllocInfo(std::move(MIBs))); - } else if (!InstCallsite.empty()) { - SmallVector StackIdIndices; - for (auto StackId : InstCallsite) - StackIdIndices.push_back(Index.addOrGetStackIdIndex(StackId)); - // Use the original CalledValue, in case it was an alias. We want - // to record the call edge to the alias in that case. Eventually - // an alias summary will be created to associate the alias and - // aliasee. - auto CalleeValueInfo = - Index.getOrInsertValueInfo(cast(CalledValue)); - Callsites.push_back({CalleeValueInfo, StackIdIndices}); - } } } Index.addBlockCount(F.size()); @@ -564,8 +508,7 @@ static void computeFunctionSummary( CallGraphEdges.takeVector(), TypeTests.takeVector(), TypeTestAssumeVCalls.takeVector(), TypeCheckedLoadVCalls.takeVector(), TypeTestAssumeConstVCalls.takeVector(), - TypeCheckedLoadConstVCalls.takeVector(), std::move(ParamAccesses), - std::move(Callsites), std::move(Allocs)); + TypeCheckedLoadConstVCalls.takeVector(), std::move(ParamAccesses)); if (NonRenamableLocal) CantBePromoted.insert(F.getGUID()); Index.addGlobalValueSummary(F, std::move(FuncSummary)); @@ -814,8 +757,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex( ArrayRef{}, ArrayRef{}, ArrayRef{}, - ArrayRef{}, - ArrayRef{}, ArrayRef{}); + ArrayRef{}); Index.addGlobalValueSummary(*GV, std::move(Summary)); } else { std::unique_ptr Summary = -- cgit v1.1