1; RUN: llvm-as -function-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
2; Check for function summary block/records.
3
4; Check the value ids in the function 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: <FUNCTION_SUMMARY_BLOCK
8; BC-NEXT: <PERMODULE_ENTRY {{.*}} op0=1 op1=0
9; BC-NEXT: <PERMODULE_ENTRY {{.*}} op0=2 op1=0
10; BC-NEXT: <PERMODULE_ENTRY {{.*}} op0=4 op1=3
11; BC-NEXT: </FUNCTION_SUMMARY_BLOCK
12; BC-NEXT: <VALUE_SYMTAB
13; BC-NEXT: <FNENTRY {{.*}} op0=1 {{.*}}> record string = 'foo'
14; BC-NEXT: <FNENTRY {{.*}} op0=2 {{.*}}> record string = 'bar'
15; BC-NEXT: <FNENTRY {{.*}} op0=4 {{.*}}> record string = 'f'
16
17; RUN: llvm-as -function-summary < %s | llvm-dis | FileCheck %s
18; Check that this round-trips correctly.
19
20; ModuleID = '<stdin>'
21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22target triple = "x86_64-unknown-linux-gnu"
23
24; CHECK: define i32 @foo()
25
26; Function Attrs: nounwind uwtable
27define i32 @foo() #0 {
28entry:
29  ret i32 1
30}
31
32; CHECK: define i32 @bar(i32 %x)
33
34; Function Attrs: nounwind uwtable
35define i32 @bar(i32 %x) #0 {
36entry:
37  ret i32 %x
38}
39
40; Check an anonymous function as well, since in that case only the alias
41; ends up in the value symbol table and having a summary.
42@f = alias void (), void ()* @0   ; <void ()*> [#uses=0]
43@h = external global void ()*     ; <void ()*> [#uses=0]
44
45define internal void @0() nounwind {
46entry:
47  store void()* @0, void()** @h
48        br label %return
49
50return:         ; preds = %entry
51        ret void
52}
53