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