brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 0f0187a Raw
82 lines · plain
1; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/offset.prof | opt -passes='print<branch-prob>' -disable-output 2>&1 | FileCheck %s2 3; Original C++ code for this test case:4;5; a.cc:6; #17; #28; #39; #410; #5 int foo(int a) {11; #6 #include "a.b"12; #7}13;14; a.b:15; #1 if (a > 0) {16; #2   return 10;17; #3 } else {18; #4   return 20;19; #5 }20 21; Function Attrs: nounwind uwtable22define i32 @_Z3fooi(i32 %a) #0 !dbg !4 {23entry:24  %retval = alloca i32, align 425  %a.addr = alloca i32, align 426  store i32 %a, ptr %a.addr, align 427  call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !11, metadata !12), !dbg !1328  %0 = load i32, ptr %a.addr, align 4, !dbg !1429  %cmp = icmp sgt i32 %0, 0, !dbg !1830  br i1 %cmp, label %if.then, label %if.else, !dbg !1931; CHECK: edge %entry -> %if.then probability is 0x0167ba82 / 0x80000000 = 1.10%32; CHECK: edge %entry -> %if.else probability is 0x7e98457e / 0x80000000 = 98.90% [HOT edge]33 34if.then:                                          ; preds = %entry35  store i32 10, ptr %retval, align 4, !dbg !2036  br label %return, !dbg !2037 38if.else:                                          ; preds = %entry39  store i32 20, ptr %retval, align 4, !dbg !2240  br label %return, !dbg !2241 42return:                                           ; preds = %if.else, %if.then43  %1 = load i32, ptr %retval, align 4, !dbg !2444  ret i32 %1, !dbg !2445}46 47; Function Attrs: nounwind readnone48declare void @llvm.dbg.declare(metadata, metadata, metadata) #149 50attributes #0 = { nounwind uwtable "use-sample-profile" }51attributes #1 = { nounwind readnone }52 53!llvm.dbg.cu = !{!0}54!llvm.module.flags = !{!8, !9}55!llvm.ident = !{!10}56 57!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 250750)", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)58!1 = !DIFile(filename: "a.cc", directory: "/tmp")59!2 = !{}60!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)61!5 = !DISubroutineType(types: !6)62!6 = !{!7, !7}63!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)64!8 = !{i32 2, !"Dwarf Version", i32 4}65!9 = !{i32 2, !"Debug Info Version", i32 3}66!10 = !{!"clang version 3.8.0 (trunk 250750)"}67!11 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 5, type: !7)68!12 = !DIExpression()69!13 = !DILocation(line: 5, column: 13, scope: !4)70!14 = !DILocation(line: 1, column: 5, scope: !15)71!15 = distinct !DILexicalBlock(scope: !17, file: !16, line: 1, column: 5)72!16 = !DIFile(filename: "./a.b", directory: "/tmp")73!17 = !DILexicalBlockFile(scope: !4, file: !16, discriminator: 0)74!18 = !DILocation(line: 1, column: 7, scope: !15)75!19 = !DILocation(line: 1, column: 5, scope: !17)76!20 = !DILocation(line: 2, column: 3, scope: !21)77!21 = distinct !DILexicalBlock(scope: !15, file: !16, line: 1, column: 12)78!22 = !DILocation(line: 4, column: 3, scope: !23)79!23 = distinct !DILexicalBlock(scope: !15, file: !16, line: 3, column: 8)80!24 = !DILocation(line: 7, column: 1, scope: !25)81!25 = !DILexicalBlockFile(scope: !4, file: !1, discriminator: 0)82