[ThinLTO] Use valueid instead of bitcode offsets in combined index file
Summary:
With the removal of support for lazy parsing of combined index summary
records (e.g. r267344), we no longer need to include the summary record
bitcode offset in the VST entries for definitions. Change the combined
index format to be similar to the per-module index format in using value
ids to cross-reference from the summary record to the VST entry (rather
than the summary record bitcode offset to cross-reference in the other
direction).
The visible changes are:
1) Add the value id to the combined summary records
2) Remove the summary offset from the combined VST records, which has
the following effects:
- No longer need the VST_CODE_COMBINED_GVDEFENTRY record, as all
combined index VST entries now only contain the value id and
corresponding GUID.
- No longer have duplicate VST entries in the case where there are
multiple definitions of a symbol (e.g. weak/linkonce), as they all
have the same value id and GUID.
An implication of #2 above is that in order to hook up an alias to the
correct aliasee based on the value id of the aliasee recorded in the
combined index alias record, we need to scan the entries in the index
for that GUID to find the one from the same module (i.e. the case where
there are multiple entries for the aliasee). But the reader no longer
has to maintain a special map to hook up the alias/aliasee.
Reviewers: joker.eph
Subscribers: joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D19481
llvm-svn: 267712
diff --git a/llvm/test/Bitcode/thinlto-alias.ll b/llvm/test/Bitcode/thinlto-alias.ll
index 56a01ec..58411ca 100644
--- a/llvm/test/Bitcode/thinlto-alias.ll
+++ b/llvm/test/Bitcode/thinlto-alias.ll
@@ -21,16 +21,16 @@
; COMBINED-NEXT: <VERSION
; See if the call to analias is registered, using the expected callsite count
; and value id matching the subsequent value symbol table.
-; COMBINED-NEXT: <COMBINED {{.*}} op4=[[ALIASID:[0-9]+]] op5=1/>
+; COMBINED-NEXT: <COMBINED {{.*}} op5=[[ALIASID:[0-9]+]] op6=1/>
; Followed by the alias and aliasee
; COMBINED-NEXT: <COMBINED {{.*}}
-; COMBINED-NEXT: <COMBINED_ALIAS {{.*}} op2=[[ALIASEEOFFSET:[0-9]+]]
+; COMBINED-NEXT: <COMBINED_ALIAS {{.*}} op3=[[ALIASEEID:[0-9]+]]
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; COMBINED-NEXT: <VALUE_SYMTAB
; Entry for function func should have entry with value id ALIASID
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY {{.*}} op0=[[ALIASID]] {{.*}} op2=-5751648690987223394/>
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY {{.*}} op1=[[ALIASEEOFFSET]] op2=-1039159065113703048/>
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[ALIASID]] op1=-5751648690987223394/>
+; COMBINED-NEXT: <COMBINED
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[ALIASEEID]] op1=-1039159065113703048/>
; COMBINED-NEXT: </VALUE_SYMTAB>
; ModuleID = 'thinlto-function-summary-callgraph.ll'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
index 7bf91a54..a927a16 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
@@ -22,12 +22,12 @@
; COMBINED-NEXT: <COMBINED
; See if the call to func is registered, using the expected callsite count
; and profile count, with value id matching the subsequent value symbol table.
-; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1 op6=1/>
+; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op5=[[FUNCID:[0-9]+]] op6=1 op7=1/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; COMBINED-NEXT: <VALUE_SYMTAB
; Entry for function func should have entry with value id FUNCID
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY {{.*}} op0=[[FUNCID]] {{.*}} op2=7289175272376759421/>
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
+; COMBINED-NEXT: <COMBINED
; COMBINED-NEXT: </VALUE_SYMTAB>
; ModuleID = 'thinlto-function-summary-callgraph.ll'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
index 878d393..af38c3e 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
@@ -22,12 +22,12 @@
; COMBINED-NEXT: <COMBINED
; See if the call to func is registered, using the expected callsite count
; and value id matching the subsequent value symbol table.
-; COMBINED-NEXT: <COMBINED {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
+; COMBINED-NEXT: <COMBINED {{.*}} op5=[[FUNCID:[0-9]+]] op6=1/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; COMBINED-NEXT: <VALUE_SYMTAB
; Entry for function func should have entry with value id FUNCID
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY {{.*}} op0=[[FUNCID]] {{.*}} op2=7289175272376759421/>
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
+; COMBINED-NEXT: <COMBINED
; COMBINED-NEXT: </VALUE_SYMTAB>
; ModuleID = 'thinlto-function-summary-callgraph.ll'
diff --git a/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll b/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
index 26cafea..8777bd9 100644
--- a/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
+++ b/llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
@@ -13,9 +13,9 @@
; COMBINED-DAG: <COMBINED_ORIGINAL_NAME op0=-4170563161550796836/>
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
; COMBINED-NEXT: <VALUE_SYMTAB
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY {{.*}} op2=4947176790635855146/>
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY {{.*}} op2=-6591587165810580810/>
-; COMBINED-NEXT: <COMBINED_GVDEFENTRY {{.*}} op2=-4377693495213223786/>
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op1=4947176790635855146/>
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op1=-6591587165810580810/>
+; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op1=-4377693495213223786/>
; COMBINED-NEXT: </VALUE_SYMTAB>
source_filename = "/path/to/source.c"
diff --git a/llvm/test/Bitcode/thinlto-summary-linkage-types.ll b/llvm/test/Bitcode/thinlto-summary-linkage-types.ll
index 86b9bdf..e8fea12 100644
--- a/llvm/test/Bitcode/thinlto-summary-linkage-types.ll
+++ b/llvm/test/Bitcode/thinlto-summary-linkage-types.ll
@@ -6,56 +6,56 @@
define private void @private()
; CHECK: <PERMODULE {{.*}} op1=8
-; COMBINED-DAG: <COMBINED {{.*}} op1=8
+; COMBINED-DAG: <COMBINED {{.*}} op2=8
{
ret void
}
define internal void @internal()
; CHECK: <PERMODULE {{.*}} op1=7
-; COMBINED-DAG: <COMBINED {{.*}} op1=7
+; COMBINED-DAG: <COMBINED {{.*}} op2=7
{
ret void
}
define available_externally void @available_externally()
; CHECK: <PERMODULE {{.*}} op1=1
-; COMBINED-DAG: <COMBINED {{.*}} op1=1
+; COMBINED-DAG: <COMBINED {{.*}} op2=1
{
ret void
}
define linkonce void @linkonce()
; CHECK: <PERMODULE {{.*}} op1=2
-; COMBINED-DAG: <COMBINED {{.*}} op1=2
+; COMBINED-DAG: <COMBINED {{.*}} op2=2
{
ret void
}
define weak void @weak()
; CHECK: <PERMODULE {{.*}} op1=4
-; COMBINED-DAG: <COMBINED {{.*}} op1=4
+; COMBINED-DAG: <COMBINED {{.*}} op2=4
{
ret void
}
define linkonce_odr void @linkonce_odr()
; CHECK: <PERMODULE {{.*}} op1=3
-; COMBINED-DAG: <COMBINED {{.*}} op1=3
+; COMBINED-DAG: <COMBINED {{.*}} op2=3
{
ret void
}
define weak_odr void @weak_odr()
; CHECK: <PERMODULE {{.*}} op1=5
-; COMBINED-DAG: <COMBINED {{.*}} op1=5
+; COMBINED-DAG: <COMBINED {{.*}} op2=5
{
ret void
}
define external void @external()
; CHECK: <PERMODULE {{.*}} op1=0
-; COMBINED-DAG: <COMBINED {{.*}} op1=0
+; COMBINED-DAG: <COMBINED {{.*}} op2=0
{
ret void
}
diff --git a/llvm/test/Bitcode/thinlto-summary-section.ll b/llvm/test/Bitcode/thinlto-summary-section.ll
index 82b6a10..d120622 100644
--- a/llvm/test/Bitcode/thinlto-summary-section.ll
+++ b/llvm/test/Bitcode/thinlto-summary-section.ll
@@ -5,7 +5,7 @@
; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED
; CHECK: <PERMODULE {{.*}} op1=16
-; COMBINED-DAG: <COMBINED {{.*}} op1=16
+; COMBINED-DAG: <COMBINED {{.*}} op2=16
define void @functionWithSection() section "some_section" {
ret void
}