You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.247
Former-commit-id: 2d6af2e4ed0eda5cbdc2946446ef7718456ad190
This commit is contained in:
parent
279aa8f685
commit
ce8e504569
71
external/llvm/lib/IR/ModuleSummaryIndex.cpp
vendored
71
external/llvm/lib/IR/ModuleSummaryIndex.cpp
vendored
@ -1,71 +0,0 @@
|
||||
//===-- ModuleSummaryIndex.cpp - Module Summary Index ---------------------===//
|
||||
//
|
||||
// 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 module index and summary classes for the
|
||||
// IR library.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/IR/ModuleSummaryIndex.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
using namespace llvm;
|
||||
|
||||
// Collect for the given module the list of function it defines
|
||||
// (GUID -> Summary).
|
||||
void ModuleSummaryIndex::collectDefinedFunctionsForModule(
|
||||
StringRef ModulePath, GVSummaryMapTy &GVSummaryMap) const {
|
||||
for (auto &GlobalList : *this) {
|
||||
auto GUID = GlobalList.first;
|
||||
for (auto &GlobSummary : GlobalList.second.SummaryList) {
|
||||
auto *Summary = dyn_cast_or_null<FunctionSummary>(GlobSummary.get());
|
||||
if (!Summary)
|
||||
// Ignore global variable, focus on functions
|
||||
continue;
|
||||
// Ignore summaries from other modules.
|
||||
if (Summary->modulePath() != ModulePath)
|
||||
continue;
|
||||
GVSummaryMap[GUID] = Summary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collect for each module the list of function it defines (GUID -> Summary).
|
||||
void ModuleSummaryIndex::collectDefinedGVSummariesPerModule(
|
||||
StringMap<GVSummaryMapTy> &ModuleToDefinedGVSummaries) const {
|
||||
for (auto &GlobalList : *this) {
|
||||
auto GUID = GlobalList.first;
|
||||
for (auto &Summary : GlobalList.second.SummaryList) {
|
||||
ModuleToDefinedGVSummaries[Summary->modulePath()][GUID] = Summary.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlobalValueSummary *
|
||||
ModuleSummaryIndex::getGlobalValueSummary(uint64_t ValueGUID,
|
||||
bool PerModuleIndex) const {
|
||||
auto VI = getValueInfo(ValueGUID);
|
||||
assert(VI && "GlobalValue not found in index");
|
||||
assert((!PerModuleIndex || VI.getSummaryList().size() == 1) &&
|
||||
"Expected a single entry per global value in per-module index");
|
||||
auto &Summary = VI.getSummaryList()[0];
|
||||
return Summary.get();
|
||||
}
|
||||
|
||||
bool ModuleSummaryIndex::isGUIDLive(GlobalValue::GUID GUID) const {
|
||||
auto VI = getValueInfo(GUID);
|
||||
if (!VI)
|
||||
return true;
|
||||
const auto &SummaryList = VI.getSummaryList();
|
||||
if (SummaryList.empty())
|
||||
return true;
|
||||
for (auto &I : SummaryList)
|
||||
if (isGlobalValueLive(I.get()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
Reference in New Issue
Block a user