blob: 0ab967dfcad94cdd002684b88f3de7ef55a68a8e [file] [log] [blame]
Mehdi Amini2d28f7a2016-04-16 06:56:44 +00001; RUN: opt -name-anon-functions -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
Teresa Johnson26ab5772016-03-15 00:04:37 +00002; Check for summary block/records.
Teresa Johnson403a7872015-10-04 14:33:43 +00003
Teresa Johnson26ab5772016-03-15 00:04:37 +00004; Check the value ids in the summary entries against the
Teresa Johnsona9a63072016-02-01 23:26:30 +00005; same in the ValueSumbolTable, to ensure the ordering is stable.
Teresa Johnson5e22e442016-02-06 16:07:35 +00006; Also check the linkage field on the summary entries.
Teresa Johnson76a1c1d2016-03-11 18:52:24 +00007; BC: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini8fe69362016-04-24 03:18:11 +00008; BC-NEXT: <VERSION
Teresa Johnson76a1c1d2016-03-11 18:52:24 +00009; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0
10; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0
Mehdi Aminic3ed48c2016-04-24 03:18:18 +000011; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
Piotr Padlewski332b3b22016-08-11 22:13:57 +000012; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=32
13; BC-NEXT: <ALIAS {{.*}} op0=5 op1=0 op2=3
Mehdi Aminib5b28932016-04-13 17:20:07 +000014; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
Teresa Johnsona9a63072016-02-01 23:26:30 +000015; BC-NEXT: <VALUE_SYMTAB
Piotr Padlewski332b3b22016-08-11 22:13:57 +000016; BC-NEXT: <FNENTRY {{.*}} op0=4 {{.*}}> record string = 'variadic'
Mehdi Aminib5b28932016-04-13 17:20:07 +000017; BC-NEXT: <FNENTRY {{.*}} op0=1 {{.*}}> record string = 'foo'
Teresa Johnsona9a63072016-02-01 23:26:30 +000018; BC-NEXT: <FNENTRY {{.*}} op0=2 {{.*}}> record string = 'bar'
Piotr Padlewski332b3b22016-08-11 22:13:57 +000019; 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
Teresa Johnson403a7872015-10-04 14:33:43 +000023
Mehdi Amini2d28f7a2016-04-16 06:56:44 +000024; RUN: opt -name-anon-functions -module-summary < %s | llvm-dis | FileCheck %s
Teresa Johnson403a7872015-10-04 14:33:43 +000025; 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
Teresa Johnson2d5487c2016-04-11 13:58:45 +000047; 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.
Teresa Johnson403a7872015-10-04 14:33:43 +000050; 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}
Piotr Padlewski332b3b22016-08-11 22:13:57 +000063
64define i32 @variadic(...) {
65 ret i32 42
66}