aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-04-04 18:52:58 +0000
committerTeresa Johnson <tejohnson@google.com>2016-04-04 18:52:58 +0000
commit916495d894a13da921896989f3825030cd720c39 (patch)
tree95102f4db60431bda53fb019962dcb4170a7323e /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent0beb858e979602ce33c7298da9d2ae02aa2d69ad (diff)
downloadllvm-916495d894a13da921896989f3825030cd720c39.zip
llvm-916495d894a13da921896989f3825030cd720c39.tar.gz
llvm-916495d894a13da921896989f3825030cd720c39.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index e784c88..09e5220 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -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;