xref: /aosp_15_r20/external/llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Test to check the callgraph in summary when there is PGO
2*9880d681SAndroid Build Coastguard Worker; RUN: opt -module-summary %s -o %t.o
3*9880d681SAndroid Build Coastguard Worker; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
5*9880d681SAndroid Build Coastguard Worker; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
6*9880d681SAndroid Build Coastguard Worker; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
9*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    <VERSION
10*9880d681SAndroid Build Coastguard Worker; See if the call to func is registered, using the expected callsite count
11*9880d681SAndroid Build Coastguard Worker; and profile count, with value id matching the subsequent value symbol table.
12*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    <PERMODULE_PROFILE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1 op6=1/>
13*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
14*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  <VALUE_SYMTAB
15*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    <FNENTRY {{.*}} record string = 'main'
16*9880d681SAndroid Build Coastguard Worker; External function func should have entry with value id FUNCID
17*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
18*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:  </VALUE_SYMTAB>
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
21*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:    <VERSION
22*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:    <COMBINED
23*9880d681SAndroid Build Coastguard Worker; See if the call to func is registered, using the expected callsite count
24*9880d681SAndroid Build Coastguard Worker; and profile count, with value id matching the subsequent value symbol table.
25*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:    <COMBINED_PROFILE {{.*}} op5=[[FUNCID:[0-9]+]] op6=1 op7=1/>
26*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
27*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:  <VALUE_SYMTAB
28*9880d681SAndroid Build Coastguard Worker; Entry for function func should have entry with value id FUNCID
29*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:    <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
30*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:    <COMBINED
31*9880d681SAndroid Build Coastguard Worker; COMBINED-NEXT:  </VALUE_SYMTAB>
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker; ModuleID = 'thinlto-function-summary-callgraph.ll'
34*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
35*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu"
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable
38*9880d681SAndroid Build Coastguard Workerdefine i32 @main() #0 !prof !2 {
39*9880d681SAndroid Build Coastguard Workerentry:
40*9880d681SAndroid Build Coastguard Worker    call void (...) @func()
41*9880d681SAndroid Build Coastguard Worker    ret i32 0
42*9880d681SAndroid Build Coastguard Worker}
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Workerdeclare void @func(...) #1
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker!2 = !{!"function_entry_count", i64 1}
47