blob: f3fb6c4f010558fb4812061ac78cfae68f769b24 [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
Mehdi Amini2d28f7a2016-04-16 06:56:44 +000012; BC-NEXT: <ALIAS {{.*}} op0=4 op1=0 op2=3
Mehdi Aminib5b28932016-04-13 17:20:07 +000013; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
Teresa Johnsona9a63072016-02-01 23:26:30 +000014; BC-NEXT: <VALUE_SYMTAB
Mehdi Amini2d28f7a2016-04-16 06:56:44 +000015; BC-NEXT: <FNENTRY {{.*}} op0=3 {{.*}}> record string = 'anon.
Mehdi Aminib5b28932016-04-13 17:20:07 +000016; BC-NEXT: <FNENTRY {{.*}} op0=1 {{.*}}> record string = 'foo'
Teresa Johnsona9a63072016-02-01 23:26:30 +000017; BC-NEXT: <FNENTRY {{.*}} op0=2 {{.*}}> record string = 'bar'
18; BC-NEXT: <FNENTRY {{.*}} op0=4 {{.*}}> record string = 'f'
Teresa Johnson403a7872015-10-04 14:33:43 +000019
Mehdi Amini2d28f7a2016-04-16 06:56:44 +000020; RUN: opt -name-anon-functions -module-summary < %s | llvm-dis | FileCheck %s
Teresa Johnson403a7872015-10-04 14:33:43 +000021; Check that this round-trips correctly.
22
23; ModuleID = '<stdin>'
24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25target triple = "x86_64-unknown-linux-gnu"
26
27; CHECK: define i32 @foo()
28
29; Function Attrs: nounwind uwtable
30define i32 @foo() #0 {
31entry:
32 ret i32 1
33}
34
35; CHECK: define i32 @bar(i32 %x)
36
37; Function Attrs: nounwind uwtable
38define i32 @bar(i32 %x) #0 {
39entry:
40 ret i32 %x
41}
42
Teresa Johnson2d5487c2016-04-11 13:58:45 +000043; FIXME: Anonymous function and alias not currently in summary until
44; follow on fixes to rename anonymous functions and emit alias summary
45; entries are committed.
Teresa Johnson403a7872015-10-04 14:33:43 +000046; Check an anonymous function as well, since in that case only the alias
47; ends up in the value symbol table and having a summary.
48@f = alias void (), void ()* @0 ; <void ()*> [#uses=0]
49@h = external global void ()* ; <void ()*> [#uses=0]
50
51define internal void @0() nounwind {
52entry:
53 store void()* @0, void()** @h
54 br label %return
55
56return: ; preds = %entry
57 ret void
58}