1; Test the profile _Z3sumii won't be mistakenly annotated to foo
2; when '-sample-profile-merge-inlinee' is enabled. When the mistake
3; happens, there will be a "No debug information found" warning message.
4; RUN: opt < %s -passes=sample-profile \
5; RUN:   -sample-profile-file=%S/Inputs/inline-mergeprof.prof \
6; RUN:   -sample-profile-merge-inlinee=true -S 2>&1| FileCheck %s
7
8@.str = private unnamed_addr constant [11 x i8] c"sum is %d\0A\00", align 1
9declare void @__cxa_call_unexpected(i8*)
10declare i32 @__gxx_personality_v0(...)
11declare i32 @_Z3subii(i32 %x, i32 %y)
12
13define i32 @main() "use-sample-profile" nounwind uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !dbg !6 {
14entry:
15  %retval = alloca i32, align 4
16  %s = alloca i32, align 4
17  %i = alloca i32, align 4
18  %tmp = load i32, i32* %i, align 4, !dbg !8
19  %tmp1 = load i32, i32* %s, align 4, !dbg !8
20  %call = invoke i32 @foo(i32 %tmp, i32 %tmp1)
21          to label %cont unwind label %lpad, !dbg !8
22; CHECK-NOT: warning: No debug information found in function foo
23; CHECK: invoke i32 @foo
24cont:
25  store i32 %call, i32* %s, align 4, !dbg !8
26  ret i32 0, !dbg !11
27lpad:
28  %lptmp0 = landingpad { i8*, i32 }
29          filter [0 x i8*] zeroinitializer
30  %lptmp1 = extractvalue { i8*, i32 } %lptmp0, 0
31  tail call void @__cxa_call_unexpected(i8* %lptmp1) noreturn nounwind
32  unreachable
33}
34
35define i32 @foo(i32 %x, i32 %y) #0 {
36entry:
37  %add = add nsw i32 %x, %y
38  ret i32 %add
39}
40
41attributes #0 = { "use-sample-profile" }
42
43declare i32 @printf(i8*, ...)
44
45!llvm.dbg.cu = !{!0}
46!llvm.module.flags = !{!3, !4}
47!llvm.ident = !{!5}
48
49!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.5 ", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
50!1 = !DIFile(filename: "calls.cc", directory: ".")
51!2 = !{}
52!3 = !{i32 2, !"Dwarf Version", i32 4}
53!4 = !{i32 1, !"Debug Info Version", i32 3}
54!5 = !{!"clang version 3.5 "}
55!6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 7, type: !7, scopeLine: 7, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
56!7 = !DISubroutineType(types: !2)
57!8 = !DILocation(line: 10, scope: !9)
58!9 = !DILexicalBlockFile(scope: !10, file: !1, discriminator: 2)
59!10 = distinct !DILexicalBlock(scope: !6, file: !1, line: 10)
60!11 = !DILocation(line: 12, scope: !6)
61