forked from OSchip/llvm-project
[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:
parent
0beb858e97
commit
916495d894
|
@ -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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
; Do setup work for all below tests: generate bitcode and combined index
|
||||
; RUN: llvm-as -module-summary %s -o %t.bc
|
||||
; RUN: llvm-as -module-summary %p/Inputs/funcimport.ll -o %t2.bc
|
||||
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
|
||||
; RUN: llvm-lto -thinlto -print-summary-global-ids -o %t3 %t.bc %t2.bc 2>&1 | FileCheck %s --check-prefix=GUID
|
||||
|
||||
; Do the import now
|
||||
; RUN: opt -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIMDEF
|
||||
|
@ -90,3 +90,38 @@ declare void @weakfunc(...) #1
|
|||
|
||||
; INSTLIMDEF-DAG: Import globalfunc2
|
||||
; INSTLIMDEF-DAG: 11 function-import - Number of functions imported
|
||||
|
||||
; The GUID values should be stable unless the global identifier scheme
|
||||
; is changed.
|
||||
; GUID-DAG: GUID 18438612909910340889 is weakalias
|
||||
; GUID-DAG: GUID 10419849736188691048 is referenceglobals
|
||||
; GUID-DAG: GUID 9779356664709680872 is weakfunc
|
||||
; GUID-DAG: GUID 15822663052811949562 is main
|
||||
; GUID-DAG: GUID 1794834399867852914 is referencecommon
|
||||
; GUID-DAG: GUID 12695095382722328222 is analias
|
||||
; GUID-DAG: GUID 11460932053523480915 is referencestatics
|
||||
; GUID-DAG: GUID 17082925359558765443 is linkoncealias
|
||||
; GUID-DAG: GUID 16956293738471118660 is setfuncptr
|
||||
; GUID-DAG: GUID 800887449839734011 is callfuncptr
|
||||
; GUID-DAG: GUID 12108029313449967842 is funcwithpersonality
|
||||
; GUID-DAG: GUID 16956293738471118660 is setfuncptr
|
||||
; GUID-DAG: GUID 15894399990123115248 is staticfunc2
|
||||
; GUID-DAG: GUID 1233668236132380018 is __gxx_personality_v0
|
||||
; GUID-DAG: GUID 11460932053523480915 is referencestatics
|
||||
; GUID-DAG: GUID 8332887114342655934 is globalfunc1
|
||||
; GUID-DAG: GUID 2602152165807499502 is globalfunc2
|
||||
; GUID-DAG: GUID 9342344237287280920 is P
|
||||
; GUID-DAG: GUID 17578217388980876465 is staticvar
|
||||
; GUID-DAG: GUID 3013670425691502549 is commonvar
|
||||
; GUID-DAG: GUID 18438612909910340889 is weakalias
|
||||
; GUID-DAG: GUID 13921022463002872889 is staticfunc
|
||||
; GUID-DAG: GUID 9779356664709680872 is weakfunc
|
||||
; GUID-DAG: GUID 10419849736188691048 is referenceglobals
|
||||
; GUID-DAG: GUID 8769477226392140800 is weakvar
|
||||
; GUID-DAG: GUID 16489816843137310249 is staticconstvar
|
||||
; GUID-DAG: GUID 12695095382722328222 is analias
|
||||
; GUID-DAG: GUID 12887606300320728018 is globalvar
|
||||
; GUID-DAG: GUID 1794834399867852914 is referencecommon
|
||||
; GUID-DAG: GUID 17082925359558765443 is linkoncealias
|
||||
; GUID-DAG: GUID 800887449839734011 is callfuncptr
|
||||
; GUID-DAG: GUID 7812846502172333492 is linkoncefunc
|
||||
|
|
Loading…
Reference in New Issue