mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
[ThinLTO] Print module summary index to assembly
Summary: Implements AsmWriter support for printing the module summary index to assembly with the format discussed in the RFC "LLVM Assembly format for ThinLTO Summary". Implements just enough of the parsing support to recognize and ignore the summary entries. As agreed in the RFC thread, this will be the behavior when assembling the IR. A follow on change will implement parsing/assembling of the summary entries for use by tools that currently build the summary index from bitcode. Reviewers: dexonsmith, pcc Subscribers: inglorion, eraman, steven_wu, dblaikie, llvm-commits Differential Revision: https://reviews.llvm.org/D46699 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333335 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
; RUN: opt -module-summary %s -o %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
||||
; RUN: opt -module-summary %p/Inputs/thinlto-alias.ll -o %t2.o
|
||||
; RUN: llvm-dis -o - %t2.o | FileCheck %s --check-prefix=DIS
|
||||
; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
|
||||
; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
|
||||
; RUN: llvm-dis -o - %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED-DIS
|
||||
|
||||
; CHECK: <SOURCE_FILENAME
|
||||
; "main"
|
||||
@@ -44,3 +46,13 @@ entry:
|
||||
}
|
||||
|
||||
declare void @analias(...)
|
||||
|
||||
; DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-alias.ll.tmp2.o", hash: (0, 0, 0, 0, 0))
|
||||
; DIS: ^1 = gv: (name: "analias", summaries: (alias: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), aliasee: ^2))) ; guid = 12695095382722328222
|
||||
; DIS: ^2 = gv: (name: "aliasee", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1))) ; guid = 17407585008595848568
|
||||
|
||||
; COMBINED-DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-alias.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; COMBINED-DIS: ^1 = module: (path: "/usr/local/google/home/tejohnson/llvm/llvm_8_build/test/Bitcode/Output/thinlto-alias.ll.tmp2.o", hash: (0, 0, 0, 0, 0))
|
||||
; COMBINED-DIS: ^2 = gv: (guid: 12695095382722328222, summaries: (alias: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), aliasee: ^4)))
|
||||
; COMBINED-DIS: ^3 = gv: (guid: 15822663052811949562, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, calls: ((callee: ^2)))))
|
||||
; COMBINED-DIS: ^4 = gv: (guid: 17407585008595848568, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
; Test to check the callgraph in summary when there is PGO
|
||||
; RUN: opt -module-summary %s -o %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
||||
; RUN: llvm-dis %t.o
|
||||
; RUN: cat %t.o.ll | FileCheck %s --check-prefix=DIS
|
||||
|
||||
; Make sure the assembler doesn't error when parsing the summary
|
||||
; RUN: llvm-as %t.o.ll
|
||||
; RUN: ls %t.o.bc
|
||||
|
||||
; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph-profile-summary.ll -o %t2.o
|
||||
; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
|
||||
; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
|
||||
; RUN: llvm-dis %t3.thinlto.bc
|
||||
; RUN: cat %t3.thinlto.ll | FileCheck %s --check-prefix=COMBINED-DIS
|
||||
|
||||
; Make sure the assembler doesn't error when parsing the combined summary
|
||||
; RUN: llvm-as %t3.thinlto.ll -o %t3.thinlto.o
|
||||
; RUN: ls %t3.thinlto.o
|
||||
|
||||
|
||||
; CHECK: <SOURCE_FILENAME
|
||||
@@ -120,3 +133,26 @@ declare void @none3() #1
|
||||
!13 = !{i32 999000, i64 100, i32 1}
|
||||
!14 = !{i32 999999, i64 1, i32 2}
|
||||
!15 = !{!"branch_weights", i32 100}
|
||||
|
||||
; DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-function-summary-callgraph-profile-summary.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; DIS: ^1 = gv: (guid: 123)
|
||||
; DIS: ^2 = gv: (name: "none2") ; guid = 3741006263754194003
|
||||
; DIS: ^3 = gv: (name: "hot3") ; guid = 5026609803865204483
|
||||
; DIS: ^4 = gv: (name: "hot2") ; guid = 8117347573235780485
|
||||
; DIS: ^5 = gv: (name: "hot1") ; guid = 9453975128311291976
|
||||
; DIS: ^6 = gv: (name: "cold") ; guid = 11668175513417606517
|
||||
; DIS: ^7 = gv: (name: "hot4") ; guid = 13161834114071272798
|
||||
; DIS: ^8 = gv: (name: "none3") ; guid = 16213681105727317812
|
||||
; DIS: ^9 = gv: (name: "hot_function", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 16, calls: ((callee: ^5, hotness: hot), (callee: ^6, hotness: cold), (callee: ^4, hotness: hot), (callee: ^7, hotness: cold), (callee: ^10, hotness: none), (callee: ^3, hotness: hot), (callee: ^2, hotness: none), (callee: ^8, hotness: none), (callee: ^1, hotness: critical))))) ; guid = 17381606045411660303
|
||||
; DIS: ^10 = gv: (name: "none1") ; guid = 17712061229457633252
|
||||
|
||||
; COMBINED-DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-function-summary-callgraph-profile-summary.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; COMBINED-DIS: ^1 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-function-summary-callgraph-profile-summary.ll.tmp2.o", hash: (0, 0, 0, 0, 0))
|
||||
; COMBINED-DIS: ^2 = gv: (guid: 3741006263754194003, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
; COMBINED-DIS: ^3 = gv: (guid: 5026609803865204483, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
; COMBINED-DIS: ^4 = gv: (guid: 8117347573235780485, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
; COMBINED-DIS: ^5 = gv: (guid: 9453975128311291976, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
; COMBINED-DIS: ^6 = gv: (guid: 11668175513417606517, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
; COMBINED-DIS: ^7 = gv: (guid: 16213681105727317812, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
; COMBINED-DIS: ^8 = gv: (guid: 17381606045411660303, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 16, calls: ((callee: ^5, hotness: hot), (callee: ^6, hotness: cold), (callee: ^4, hotness: hot), (callee: ^9, hotness: none), (callee: ^3, hotness: hot), (callee: ^2, hotness: none), (callee: ^7, hotness: none)))))
|
||||
; COMBINED-DIS: ^9 = gv: (guid: 17712061229457633252, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
; Test to check the callgraph in summary
|
||||
; RUN: opt -write-relbf-to-summary -module-summary %s -o %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
||||
; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
|
||||
|
||||
|
||||
; CHECK: <SOURCE_FILENAME
|
||||
@@ -33,3 +34,8 @@ declare void @func(...) #1
|
||||
@undefinedglob = external global i32
|
||||
|
||||
; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
|
||||
|
||||
; DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-function-summary-callgraph-relbf.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; DIS: ^1 = gv: (name: "func") ; guid = 7289175272376759421
|
||||
; DIS: ^2 = gv: (name: "main", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 3, calls: ((callee: ^1, relbf: 256)), refs: (^3)))) ; guid = 15822663052811949562
|
||||
; DIS: ^3 = gv: (name: "undefinedglob") ; guid = 18036901804029949403
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
; Test to check both the callgraph and refgraph in summary
|
||||
; RUN: opt -module-summary %s -o %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
||||
; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
|
||||
|
||||
; CHECK: <SOURCE_FILENAME
|
||||
; "bar"
|
||||
@@ -140,3 +141,17 @@ entry:
|
||||
call i8 @llvm.ctpop.i8( i8 10 )
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-function-summary-refgraph.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; DIS: ^1 = gv: (name: "Z", summaries: (function: (module: ^0, flags: (linkage: linkonce_odr, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, calls: ((callee: ^8))))) ; guid = 104084381700047393
|
||||
; DIS: ^2 = gv: (name: "X", summaries: (function: (module: ^0, flags: (linkage: available_externally, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, calls: ((callee: ^4)), refs: (^4)))) ; guid = 1881667236089500162
|
||||
; DIS: ^3 = gv: (name: "W", summaries: (function: (module: ^0, flags: (linkage: weak_odr, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, calls: ((callee: ^6)), refs: (^7)))) ; guid = 5790125716599269729
|
||||
; DIS: ^4 = gv: (name: "foo") ; guid = 6699318081062747564
|
||||
; DIS: ^5 = gv: (name: "func") ; guid = 7289175272376759421
|
||||
; DIS: ^6 = gv: (name: "func3") ; guid = 11517462787082255043
|
||||
; DIS: ^7 = gv: (name: "globalvar", summaries: (variable: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0)))) ; guid = 12887606300320728018
|
||||
; DIS: ^8 = gv: (name: "func2") ; guid = 14069196320850861797
|
||||
; DIS: ^9 = gv: (name: "llvm.ctpop.i8") ; guid = 15254915475081819833
|
||||
; DIS: ^10 = gv: (name: "main", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 9, calls: ((callee: ^5)), refs: (^5)))) ; guid = 15822663052811949562
|
||||
; DIS: ^11 = gv: (name: "bar", summaries: (variable: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), refs: (^5)))) ; guid = 16434608426314478903
|
||||
; DIS: ^12 = gv: (name: "Y", summaries: (function: (module: ^0, flags: (linkage: private, notEligibleToImport: 0, live: 0, dsoLocal: 1), insts: 14, calls: ((callee: ^8))))) ; guid = 18057131226797195731
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
; RUN: opt -module-summary %s -o %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
||||
; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
|
||||
; RUN: llvm-lto -thinlto -o %t2 %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck --check-prefix=COMBINED %s
|
||||
; RUN: llvm-dis -o - %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED-DIS
|
||||
|
||||
; COMBINED: <TYPE_TESTS op0=-2012135647395072713/>
|
||||
; COMBINED: <TYPE_TESTS op0=6699318081062747564 op1=-2012135647395072713/>
|
||||
@@ -28,3 +30,14 @@ define i1 @h() {
|
||||
}
|
||||
|
||||
declare i1 @llvm.type.test(i8*, metadata) nounwind readnone
|
||||
|
||||
; DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-type-tests.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; DIS: ^1 = gv: (name: "llvm.type.test") ; guid = 608142985856744218
|
||||
; DIS: ^2 = gv: (name: "h", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (16434608426314478903))))) ; guid = 8124147457056772133
|
||||
; DIS: ^3 = gv: (name: "g", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 4, typeIdInfo: (typeTests: (6699318081062747564, 16434608426314478903))))) ; guid = 13146401226427987378
|
||||
; DIS: ^4 = gv: (name: "f", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (6699318081062747564))))) ; guid = 14740650423002898831
|
||||
|
||||
; COMBINED-DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-type-tests.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; COMBINED-DIS: ^1 = gv: (guid: 8124147457056772133, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (16434608426314478903)))))
|
||||
; COMBINED-DIS: ^2 = gv: (guid: 13146401226427987378, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 4, typeIdInfo: (typeTests: (6699318081062747564, 16434608426314478903)))))
|
||||
; COMBINED-DIS: ^3 = gv: (guid: 14740650423002898831, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (6699318081062747564)))))
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
; RUN: opt -module-summary %s -o %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
||||
; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
|
||||
; RUN: llvm-lto -thinlto -o %t2 %t.o
|
||||
; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck --check-prefix=COMBINED %s
|
||||
; RUN: llvm-dis -o - %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED-DIS
|
||||
|
||||
target datalayout = "e-p:64:64"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
@@ -103,3 +105,22 @@ define {i8*, i1} @f6(i8* %vtable) {
|
||||
declare i1 @llvm.type.test(i8*, metadata) nounwind readnone
|
||||
declare void @llvm.assume(i1)
|
||||
declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
|
||||
|
||||
; DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-type-vcalls.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; DIS: ^1 = gv: (name: "llvm.type.test") ; guid = 608142985856744218
|
||||
; DIS: ^2 = gv: (name: "f1", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 8, typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16)))))) ; guid = 2072045998141807037
|
||||
; DIS: ^3 = gv: (name: "f3", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 5, typeIdInfo: (typeCheckedLoadVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16)))))) ; guid = 4197650231481825559
|
||||
; DIS: ^4 = gv: (name: "llvm.type.checked.load") ; guid = 5568222536364573403
|
||||
; DIS: ^5 = gv: (name: "llvm.assume") ; guid = 6385187066495850096
|
||||
; DIS: ^6 = gv: (name: "f2", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 15, typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 24), vFuncId: (guid: 16434608426314478903, offset: 32)))))) ; guid = 8471399308421654326
|
||||
; DIS: ^7 = gv: (name: "f4", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 15, typeIdInfo: (typeTestAssumeConstVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16), args: (42), vFuncId: (guid: 6699318081062747564, offset: 24), args: (43)))))) ; guid = 10064745020953272174
|
||||
; DIS: ^8 = gv: (name: "f5", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 5, typeIdInfo: (typeCheckedLoadConstVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16), args: (42)))))) ; guid = 11686717102184386164
|
||||
; DIS: ^9 = gv: (name: "f6", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (7546896869197086323))))) ; guid = 11834966808443348068
|
||||
|
||||
; COMBINED-DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-type-vcalls.ll.tmp.o", hash: (0, 0, 0, 0, 0))
|
||||
; COMBINED-DIS: ^1 = gv: (guid: 2072045998141807037, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 8, typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16))))))
|
||||
; COMBINED-DIS: ^2 = gv: (guid: 4197650231481825559, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 5, typeIdInfo: (typeCheckedLoadVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16))))))
|
||||
; COMBINED-DIS: ^3 = gv: (guid: 8471399308421654326, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 15, typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 24), vFuncId: (guid: 16434608426314478903, offset: 32))))))
|
||||
; COMBINED-DIS: ^4 = gv: (guid: 10064745020953272174, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 15, typeIdInfo: (typeTestAssumeConstVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16), args: (42), vFuncId: (guid: 6699318081062747564, offset: 24), args: (43))))))
|
||||
; COMBINED-DIS: ^5 = gv: (guid: 11686717102184386164, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 5, typeIdInfo: (typeCheckedLoadConstVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16), args: (42))))))
|
||||
; COMBINED-DIS: ^6 = gv: (guid: 11834966808443348068, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (7546896869197086323)))))
|
||||
|
||||
Reference in New Issue
Block a user