[ThinLTO] Add option to dump value name to GUID mapping
Summary: Useful for debugging since we lose this correlation after the permodule summary/VST is read and until we later materialize source modules in the function importer. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D18555 llvm-svn: 265327
This commit is contained in:
@@ -29,7 +29,9 @@
|
||||
#include "llvm/IR/OperandTraits.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/ValueHandle.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/DataStream.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
@@ -38,6 +40,11 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static cl::opt<bool> PrintSummaryGUIDs(
|
||||
"print-summary-global-ids", cl::init(false), cl::Hidden,
|
||||
cl::desc(
|
||||
"Print the global id for each value when reading the module summary"));
|
||||
|
||||
namespace {
|
||||
enum {
|
||||
SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex
|
||||
@@ -5520,8 +5527,11 @@ std::error_code ModuleSummaryIndexBitcodeReader::parseValueSymbolTable(
|
||||
"No linkage found for VST entry?");
|
||||
std::string GlobalId = GlobalValue::getGlobalIdentifier(
|
||||
ValueName, VLI->second, SourceFileName);
|
||||
TheIndex->addGlobalValueInfo(GlobalId, std::move(GlobalValInfo));
|
||||
ValueIdToCallGraphGUIDMap[ValueID] = GlobalValue::getGUID(GlobalId);
|
||||
auto ValueGUID = GlobalValue::getGUID(GlobalId);
|
||||
if (PrintSummaryGUIDs)
|
||||
dbgs() << "GUID " << ValueGUID << " is " << ValueName << "\n";
|
||||
TheIndex->addGlobalValueInfo(ValueGUID, std::move(GlobalValInfo));
|
||||
ValueIdToCallGraphGUIDMap[ValueID] = ValueGUID;
|
||||
ValueName.clear();
|
||||
break;
|
||||
}
|
||||
@@ -5540,9 +5550,11 @@ std::error_code ModuleSummaryIndexBitcodeReader::parseValueSymbolTable(
|
||||
"No linkage found for VST entry?");
|
||||
std::string FunctionGlobalId = GlobalValue::getGlobalIdentifier(
|
||||
ValueName, VLI->second, SourceFileName);
|
||||
TheIndex->addGlobalValueInfo(FunctionGlobalId, std::move(FuncInfo));
|
||||
ValueIdToCallGraphGUIDMap[ValueID] =
|
||||
GlobalValue::getGUID(FunctionGlobalId);
|
||||
auto FunctionGUID = GlobalValue::getGUID(FunctionGlobalId);
|
||||
if (PrintSummaryGUIDs)
|
||||
dbgs() << "GUID " << FunctionGUID << " is " << ValueName << "\n";
|
||||
TheIndex->addGlobalValueInfo(FunctionGUID, std::move(FuncInfo));
|
||||
ValueIdToCallGraphGUIDMap[ValueID] = FunctionGUID;
|
||||
|
||||
ValueName.clear();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user