| 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 |
| 9 |
declare void @__cxa_call_unexpected(ptr) |
| 10 |
declare i32 @__gxx_personality_v0(...) |
| 11 |
declare i32 @_Z3subii(i32 %x, i32 %y) |
| 12 |
|
| 13 |
define i32 @main() "use-sample-profile" nounwind uwtable ssp personality ptr @__gxx_personality_v0 !dbg !6 { |
| 14 |
entry: |
| 15 |
%retval = alloca i32, align 4 |
| 16 |
%s = alloca i32, align 4 |
| 17 |
%i = alloca i32, align 4 |
| 18 |
%tmp = load i32, ptr %i, align 4, !dbg !8 |
| 19 |
%tmp1 = load i32, ptr %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 |
| 24 |
cont: |
| 25 |
store i32 %call, ptr %s, align 4, !dbg !8 |
| 26 |
ret i32 0, !dbg !11 |
| 27 |
lpad: |
| 28 |
%lptmp0 = landingpad { ptr, i32 } |
| 29 |
filter [0 x ptr] zeroinitializer |
| 30 |
%lptmp1 = extractvalue { ptr, i32 } %lptmp0, 0 |
| 31 |
tail call void @__cxa_call_unexpected(ptr %lptmp1) noreturn nounwind |
| 32 |
unreachable |
| 33 |
} |
| 34 |
|
| 35 |
define i32 @foo(i32 %x, i32 %y) #0 { |
| 36 |
entry: |
| 37 |
%add = add nsw i32 %x, %y |
| 38 |
ret i32 %add |
| 39 |
} |
| 40 |
|
| 41 |
attributes #0 = { "use-sample-profile" } |
| 42 |
|
| 43 |
declare i32 @printf(ptr, ...) |
| 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) |