106 lines · plain
1; Test we lose details of not inlined profile without '-sample-profile-merge-inlinee'2; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-mergeprof.prof -sample-profile-merge-inlinee=false -use-profiled-call-graph=0 -S | FileCheck -check-prefix=SCALE %s3 4; Test we properly merge not inlined profile with '-sample-profile-merge-inlinee'5; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-mergeprof.prof -sample-profile-merge-inlinee=true -use-profiled-call-graph=0 -S | FileCheck -check-prefix=MERGE %s6; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-mergeprof.prof -sample-profile-merge-inlinee=true -use-profiled-call-graph=0 -sample-profile-prioritized-inline=1 -S | FileCheck -check-prefix=MERGE %s7 8; Test we properly merge not inlined profile with '-sample-profile-merge-inlinee'9; when the profile uses md5.10; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-mergeprof.md5.prof -sample-profile-merge-inlinee=true -use-profiled-call-graph=0 -S | FileCheck -check-prefix=MERGE %s11 12; Test we properly merge not inlined profile with '--sample-profile-merge-inlinee' even if '--disable-sample-loader-inlining' is true13; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-mergeprof.md5.prof -sample-profile-merge-inlinee=true --disable-sample-loader-inlining -use-profiled-call-graph=0 -S | FileCheck -check-prefix=MERGE %s14 15@.str = private unnamed_addr constant [11 x i8] c"sum is %d\0A\00", align 116 17define i32 @main() #0 !dbg !6 {18entry:19 %retval = alloca i32, align 420 %s = alloca i32, align 421 %i = alloca i32, align 422 %tmp = load i32, ptr %i, align 4, !dbg !823 %tmp1 = load i32, ptr %s, align 4, !dbg !824 %call = call i32 @_Z3sumii(i32 %tmp, i32 %tmp1), !dbg !825; SCALE: call i32 @_Z3sumii26; MERGE: call i32 @_Z3sumii27 store i32 %call, ptr %s, align 4, !dbg !828 ret i32 0, !dbg !1129}30 31define i32 @_Z3sumii(i32 %x, i32 %y) #0 !dbg !12 {32entry:33 %x.addr = alloca i32, align 434 %y.addr = alloca i32, align 435 store i32 %x, ptr %x.addr, align 436 store i32 %y, ptr %y.addr, align 437 %tmp = load i32, ptr %x.addr, align 4, !dbg !1338 %tmp1 = load i32, ptr %y.addr, align 4, !dbg !1339 %add = add nsw i32 %tmp, %tmp1, !dbg !1340 %tmp2 = load i32, ptr %x.addr, align 4, !dbg !1341 %tmp3 = load i32, ptr %y.addr, align 4, !dbg !1342 %cmp1 = icmp ne i32 %tmp3, 100, !dbg !1343 br i1 %cmp1, label %if.then, label %if.else, !dbg !1344 45if.then: ; preds = %entry46 %call = call i32 @_Z3subii(i32 %tmp2, i32 %tmp3), !dbg !1447 ret i32 %add, !dbg !1448 49if.else: ; preds = %entry50 ret i32 %add, !dbg !1551}52 53define i32 @_Z3subii(i32 %x, i32 %y) #0 !dbg !16 {54entry:55 %x.addr = alloca i32, align 456 %y.addr = alloca i32, align 457 store i32 %x, ptr %x.addr, align 458 store i32 %y, ptr %y.addr, align 459 %tmp = load i32, ptr %x.addr, align 4, !dbg !1760 %tmp1 = load i32, ptr %y.addr, align 4, !dbg !1761 %add = sub nsw i32 %tmp, %tmp1, !dbg !1762 ret i32 %add, !dbg !1863}64 65attributes #0 = { "use-sample-profile" }66 67declare i32 @printf(ptr, ...)68 69!llvm.dbg.cu = !{!0}70!llvm.module.flags = !{!3, !4}71!llvm.ident = !{!5}72 73!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)74!1 = !DIFile(filename: "calls.cc", directory: ".")75!2 = !{}76!3 = !{i32 2, !"Dwarf Version", i32 4}77!4 = !{i32 1, !"Debug Info Version", i32 3}78!5 = !{!"clang version 3.5 "}79!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)80!7 = !DISubroutineType(types: !2)81!8 = !DILocation(line: 10, scope: !9)82!9 = !DILexicalBlockFile(scope: !10, file: !1, discriminator: 2)83!10 = distinct !DILexicalBlock(scope: !6, file: !1, line: 10)84!11 = !DILocation(line: 12, scope: !6)85!12 = distinct !DISubprogram(name: "sum", scope: !1, file: !1, line: 3, type: !7, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)86!13 = !DILocation(line: 4, scope: !12)87!14 = !DILocation(line: 5, scope: !12)88!15 = !DILocation(line: 6, scope: !12)89!16 = distinct !DISubprogram(name: "sub", scope: !1, file: !1, line: 20, type: !7, scopeLine: 20, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)90!17 = !DILocation(line: 20, scope: !16)91!18 = !DILocation(line: 21, scope: !16)92 93; SCALE: name: "sum"94; SCALE-NEXT: {!"function_entry_count", i64 46}95; SCALE: !{!"branch_weights", i32 11, i32 2}96; SCALE: !{!"branch_weights", i32 20}97; SCALE: name: "sub"98; SCALE-NEXT: {!"function_entry_count", i64 -1}99 100; MERGE: name: "sum"101; MERGE-NEXT: {!"function_entry_count", i64 46}102; MERGE: !{!"branch_weights", i32 11, i32 23}103; MERGE: !{!"branch_weights", i32 10}104; MERGE: name: "sub"105; MERGE-NEXT: {!"function_entry_count", i64 3}106