1; RUN: opt -deadargelim -S < %s | FileCheck %s
2
3; Check if function level metadatas are properly cloned.
4
5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-unknown-linux-gnu"
7
8@s = common dso_local local_unnamed_addr global i32 0, align 4
9
10define internal i32 @va_func(i32 %num, ...) !prof !28 !PGOFuncName !29{
11; CHECK: define internal void @va_func(i32 %num) !prof ![[ENTRYCOUNT:[0-9]+]] !PGOFuncName ![[PGOFUNCNAME1:[0-9]+]] {
12entry:
13  %0 = load i32, i32* @s, align 4, !tbaa !31
14  %add = add nsw i32 %0, %num
15  store i32 %add, i32* @s, align 4, !tbaa !31
16  ret i32 0
17}
18
19define internal fastcc i32 @foo() unnamed_addr !prof !28 !PGOFuncName !30 {
20; CHECK: define internal fastcc void @foo() unnamed_addr !prof ![[ENTRYCOUNT:[0-9]+]] !PGOFuncName ![[PGOFUNCNAME2:[0-9]+]] {
21entry:
22  %0 = load i32, i32* @s, align 4, !tbaa !31
23  %add = add nsw i32 %0, 8
24  store i32 %add, i32* @s, align 4, !tbaa !31
25  ret i32 0
26}
27
28!llvm.module.flags = !{!0, !1}
29
30!0 = !{i32 1, !"wchar_size", i32 4}
31!1 = !{i32 1, !"ProfileSummary", !2}
32!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
33!3 = !{!"ProfileFormat", !"InstrProf"}
34!4 = !{!"TotalCount", i64 2}
35!5 = !{!"MaxCount", i64 1}
36!6 = !{!"MaxInternalCount", i64 0}
37!7 = !{!"MaxFunctionCount", i64 1}
38!8 = !{!"NumCounts", i64 2}
39!9 = !{!"NumFunctions", i64 2}
40!10 = !{!"DetailedSummary", !11}
41!11 = !{!12, !13, !14, !15, !16, !17, !17, !18, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27}
42!12 = !{i32 10000, i64 0, i32 0}
43!13 = !{i32 100000, i64 0, i32 0}
44!14 = !{i32 200000, i64 0, i32 0}
45!15 = !{i32 300000, i64 0, i32 0}
46!16 = !{i32 400000, i64 0, i32 0}
47!17 = !{i32 500000, i64 1, i32 2}
48!18 = !{i32 600000, i64 1, i32 2}
49!19 = !{i32 700000, i64 1, i32 2}
50!20 = !{i32 800000, i64 1, i32 2}
51!21 = !{i32 900000, i64 1, i32 2}
52!22 = !{i32 950000, i64 1, i32 2}
53!23 = !{i32 990000, i64 1, i32 2}
54!24 = !{i32 999000, i64 1, i32 2}
55!25 = !{i32 999900, i64 1, i32 2}
56!26 = !{i32 999990, i64 1, i32 2}
57!27 = !{i32 999999, i64 1, i32 2}
58!28 = !{!"function_entry_count", i64 1}
59; CHECK: ![[ENTRYCOUNT]] = !{!"function_entry_count", i64 1}
60!29 = !{!"foo.c:va_func"}
61; CHECK: ![[PGOFUNCNAME1]] = !{!"foo.c:va_func"}
62!30 = !{!"foo.c:foo"}
63; CHECK: ![[PGOFUNCNAME2]] = !{!"foo.c:foo"}
64!31 = !{!32, !32, i64 0}
65!32 = !{!"int", !33, i64 0}
66!33 = !{!"omnipotent char", !34, i64 0}
67!34 = !{!"Simple C/C++ TBAA"}
68