blob: 636b96cb6e96ca98ce27da47c4d1554f4539061d [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 Johnson4223dd82016-08-12 14:03:36 +00002; RUN: opt -passes=name-anon-functions -module-summary < %s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=BC
Teresa Johnson26ab5772016-03-15 00:04:37 +00003; Check for summary block/records.
Teresa Johnson403a7872015-10-04 14:33:43 +00004
Teresa Johnson26ab5772016-03-15 00:04:37 +00005; Check the value ids in the summary entries against the
Teresa Johnsona9a63072016-02-01 23:26:30 +00006; same in the ValueSumbolTable, to ensure the ordering is stable.
Teresa Johnson5e22e442016-02-06 16:07:35 +00007; Also check the linkage field on the summary entries.
Teresa Johnson76a1c1d2016-03-11 18:52:24 +00008; BC: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini8fe69362016-04-24 03:18:11 +00009; BC-NEXT: <VERSION
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000010; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0
11; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0
Mehdi Aminic3ed48c2016-04-24 03:18:18 +000012; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
Piotr Padlewski332b3b22016-08-11 22:13:57 +000013; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=32
14; BC-NEXT: <ALIAS {{.*}} op0=5 op1=0 op2=3
Mehdi Aminib5b28932016-04-13 17:20:07 +000015; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
Teresa Johnsona9a63072016-02-01 23:26:30 +000016; BC-NEXT: <VALUE_SYMTAB
Piotr Padlewski332b3b22016-08-11 22:13:57 +000017; BC-NEXT: <FNENTRY {{.*}} op0=4 {{.*}}> record string = 'variadic'
Mehdi Aminib5b28932016-04-13 17:20:07 +000018; BC-NEXT: <FNENTRY {{.*}} op0=1 {{.*}}> record string = 'foo'
Teresa Johnsona9a63072016-02-01 23:26:30 +000019; BC-NEXT: <FNENTRY {{.*}} op0=2 {{.*}}> record string = 'bar'
Piotr Padlewski332b3b22016-08-11 22:13:57 +000020; BC-NEXT: <FNENTRY {{.*}} op0=5 {{.*}}> record string = 'f'
21; BC-NEXT: <ENTRY {{.*}} record string = 'h'
22; BC-NEXT: <FNENTRY {{.*}} op0=3 {{.*}}> record string = 'anon.
23
Teresa Johnson403a7872015-10-04 14:33:43 +000024
Mehdi Amini2d28f7a2016-04-16 06:56:44 +000025; RUN: opt -name-anon-functions -module-summary < %s | llvm-dis | FileCheck %s
Teresa Johnson403a7872015-10-04 14:33:43 +000026; Check that this round-trips correctly.
27
28; ModuleID = '<stdin>'
29target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
30target triple = "x86_64-unknown-linux-gnu"
31
32; CHECK: define i32 @foo()
33
34; Function Attrs: nounwind uwtable
35define i32 @foo() #0 {
36entry:
37 ret i32 1
38}
39
40; CHECK: define i32 @bar(i32 %x)
41
42; Function Attrs: nounwind uwtable
43define i32 @bar(i32 %x) #0 {
44entry:
45 ret i32 %x
46}
47
Teresa Johnson2d5487c2016-04-11 13:58:45 +000048; FIXME: Anonymous function and alias not currently in summary until
49; follow on fixes to rename anonymous functions and emit alias summary
50; entries are committed.
Teresa Johnson403a7872015-10-04 14:33:43 +000051; Check an anonymous function as well, since in that case only the alias
52; ends up in the value symbol table and having a summary.
53@f = alias void (), void ()* @0 ; <void ()*> [#uses=0]
54@h = external global void ()* ; <void ()*> [#uses=0]
55
56define internal void @0() nounwind {
57entry:
58 store void()* @0, void()** @h
59 br label %return
60
61return: ; preds = %entry
62 ret void
63}
Piotr Padlewski332b3b22016-08-11 22:13:57 +000064
65define i32 @variadic(...) {
66 ret i32 42
67}