xref: /llvm-project/llvm/test/Bitcode/thinlto-function-summary.ll (revision ab7dba233a058cc8310ef829929238b5d8440b30)
1; RUN: opt -passes=name-anon-globals -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
2; Check for summary block/records.
3
4; BC: <SOURCE_FILENAME
5; "h"
6; BC-NEXT: <GLOBALVAR {{.*}} op0=0 op1=1
7; "foo"
8; BC-NEXT: <FUNCTION op0=1 op1=3
9; "bar"
10; BC-NEXT: <FUNCTION op0=4 op1=3
11; "anon.[32 chars].0"
12; BC-NEXT: <FUNCTION op0=7 op1=39
13; "variadic"
14; BC-NEXT: <FUNCTION op0=46 op1=8
15; "llvm.va_start"
16; BC-NEXT: <FUNCTION op0=54 op1=16
17; "f"
18; BC-NEXT: <ALIAS op0=70 op1=1
19; BC: <GLOBALVAL_SUMMARY_BLOCK
20; BC-NEXT: <VERSION
21; BC-NEXT: <FLAGS
22; BC-NEXT: <PERMODULE_PROFILE {{.*}} op0=1 op1=0
23; BC-NEXT: <PERMODULE_PROFILE {{.*}} op0=2 op1=0
24; BC-NEXT: <PERMODULE_PROFILE {{.*}} op0=3 op1=7
25; BC-NEXT: <PERMODULE_PROFILE {{.*}} op0=4 op1=0 op2=4 op3=0
26; BC-NEXT: <ALIAS {{.*}} op0=6 op1=0 op2=3
27; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
28; BC: <STRTAB_BLOCK
29; BC-NEXT: blob data = 'hfoobaranon.{{................................}}.0variadicllvm.va_start.p{{[0-9]+}}f{{.*}}'
30
31
32; RUN: opt -passes=name-anon-globals -module-summary < %s | llvm-dis | FileCheck %s
33; RUN: opt -passes=name-anon-globals -module-summary -S < %s | FileCheck %s
34; RUN: opt -passes=name-anon-globals -module-summary -S < %s | llvm-as | llvm-dis | FileCheck %s
35; Check that this round-trips correctly.
36
37; ModuleID = '<stdin>'
38target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
39target triple = "x86_64-unknown-linux-gnu"
40
41; CHECK: define i32 @foo()
42
43; Function Attrs: nounwind uwtable
44define i32 @foo() #0 {
45entry:
46  ret i32 1
47}
48
49; CHECK: define i32 @bar(i32 %x)
50
51; Function Attrs: nounwind uwtable
52define i32 @bar(i32 %x) #0 {
53entry:
54  ret i32 %x
55}
56
57; FIXME: Anonymous function and alias not currently in summary until
58; follow on fixes to rename anonymous globals and emit alias summary
59; entries are committed.
60; Check an anonymous function as well, since in that case only the alias
61; ends up in the value symbol table and having a summary.
62@f = alias void (), void ()* @0   ; <ptr> [#uses=0]
63@h = external global void ()*     ; <ptr> [#uses=0]
64
65define internal void @0() nounwind {
66entry:
67  store void()* @0, void()** @h
68        br label %return
69
70return:         ; preds = %entry
71        ret void
72}
73
74define i32 @variadic(...) {
75    %ap = alloca i8*, align 8
76    %ap.0 = bitcast i8** %ap to i8*
77    call void @llvm.va_start(i8* %ap.0)
78    ret i32 42
79}
80
81declare void @llvm.va_start(i8*) nounwind
82