1; RUN: opt -name-anon-functions -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
2; Check for summary block/records.
3
4; Check the value ids in the summary entries against the
5; same in the ValueSumbolTable, to ensure the ordering is stable.
6; Also check the linkage field on the summary entries.
7; BC: <GLOBALVAL_SUMMARY_BLOCK
8; BC-NEXT: <VERSION
9; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0
10; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0
11; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
12; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=32
13; BC-NEXT: <ALIAS {{.*}} op0=5 op1=0 op2=3
14; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
15; BC-NEXT: <VALUE_SYMTAB
16; BC-NEXT: <FNENTRY {{.*}} op0=4 {{.*}}> record string = 'variadic'
17; BC-NEXT: <FNENTRY {{.*}} op0=1 {{.*}}> record string = 'foo'
18; BC-NEXT: <FNENTRY {{.*}} op0=2 {{.*}}> record string = 'bar'
19; BC-NEXT: <FNENTRY {{.*}} op0=5 {{.*}}> record string = 'f'
20; BC-NEXT: <ENTRY {{.*}} record string = 'h'
21; BC-NEXT: <FNENTRY {{.*}} op0=3 {{.*}}> record string = 'anon.
22
23
24; RUN: opt -name-anon-functions -module-summary < %s | llvm-dis | FileCheck %s
25; Check that this round-trips correctly.
26
27; ModuleID = '<stdin>'
28target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
29target triple = "x86_64-unknown-linux-gnu"
30
31; CHECK: define i32 @foo()
32
33; Function Attrs: nounwind uwtable
34define i32 @foo() #0 {
35entry:
36  ret i32 1
37}
38
39; CHECK: define i32 @bar(i32 %x)
40
41; Function Attrs: nounwind uwtable
42define i32 @bar(i32 %x) #0 {
43entry:
44  ret i32 %x
45}
46
47; FIXME: Anonymous function and alias not currently in summary until
48; follow on fixes to rename anonymous functions and emit alias summary
49; entries are committed.
50; Check an anonymous function as well, since in that case only the alias
51; ends up in the value symbol table and having a summary.
52@f = alias void (), void ()* @0   ; <void ()*> [#uses=0]
53@h = external global void ()*     ; <void ()*> [#uses=0]
54
55define internal void @0() nounwind {
56entry:
57  store void()* @0, void()** @h
58        br label %return
59
60return:         ; preds = %entry
61        ret void
62}
63
64define i32 @variadic(...) {
65    ret i32 42
66}
67