1; Verify the behavior of the IntelJITEventListener. 2; RUN: llvm-jitlistener %s | FileCheck %s 3 4; This test was created using the following file: 5; 6; 1: int foo(int a) { 7; 2: return a; 8; 3: } 9; 4: 10; 5: int bar(int a) { 11; 6: if (a == 0) { 12; 7: return 0; 13; 8: } 14; 9: return 100/a; 15; 10: } 16; 11: 17; 12: int fubar(int a) { 18; 13: switch (a) { 19; 14: case 0: 20; 15: return 10; 21; 16: case 1: 22; 17: return 20; 23; 18: default: 24; 19: return 30; 25; 20: } 26; 21: } 27; 28 29; CHECK: Method load [1]: bar, Size = {{[0-9]+}} 30; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[5,6,7,9]}} 31; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[5,6,7,9]}} 32; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[5,6,7,9]}} 33; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[5,6,7,9]}} 34 35; CHECK: Method load [2]: foo, Size = {{[0-9]+}} 36; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[1,2]}} 37; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[1,2]}} 38 39; CHECK: Method load [3]: fubar, Size = {{[0-9]+}} 40; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[12,13,15,17,19]}} 41; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[12,13,15,17,19]}} 42; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[12,13,15,17,19]}} 43; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[12,13,15,17,19]}} 44; CHECK: Line info @ {{[0-9]+}}: multiple.c, line {{[12,13,15,17,19]}} 45 46; CHECK: Method unload [1] 47; CHECK: Method unload [2] 48; CHECK: Method unload [3] 49 50; ModuleID = 'multiple.c' 51 52; Function Attrs: nounwind uwtable 53define i32 @foo(i32 %a) #0 !dbg !4 { 54entry: 55 %a.addr = alloca i32, align 4 56 store i32 %a, i32* %a.addr, align 4 57 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !15, metadata !16), !dbg !17 58 %0 = load i32, i32* %a.addr, align 4, !dbg !18 59 ret i32 %0, !dbg !19 60} 61 62; Function Attrs: nounwind readnone 63declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 64 65; Function Attrs: nounwind uwtable 66define i32 @bar(i32 %a) #0 !dbg !9 { 67entry: 68 %retval = alloca i32, align 4 69 %a.addr = alloca i32, align 4 70 store i32 %a, i32* %a.addr, align 4 71 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !20, metadata !16), !dbg !21 72 %0 = load i32, i32* %a.addr, align 4, !dbg !22 73 %cmp = icmp eq i32 %0, 0, !dbg !22 74 br i1 %cmp, label %if.then, label %if.end, !dbg !24 75 76if.then: ; preds = %entry 77 store i32 0, i32* %retval, !dbg !25 78 br label %return, !dbg !25 79 80if.end: ; preds = %entry 81 %1 = load i32, i32* %a.addr, align 4, !dbg !27 82 %div = sdiv i32 100, %1, !dbg !28 83 store i32 %div, i32* %retval, !dbg !29 84 br label %return, !dbg !29 85 86return: ; preds = %if.end, %if.then 87 %2 = load i32, i32* %retval, !dbg !30 88 ret i32 %2, !dbg !30 89} 90 91; Function Attrs: nounwind uwtable 92define i32 @fubar(i32 %a) #0 !dbg !10 { 93entry: 94 %retval = alloca i32, align 4 95 %a.addr = alloca i32, align 4 96 store i32 %a, i32* %a.addr, align 4 97 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !31, metadata !16), !dbg !32 98 %0 = load i32, i32* %a.addr, align 4, !dbg !33 99 switch i32 %0, label %sw.default [ 100 i32 0, label %sw.bb 101 i32 1, label %sw.bb1 102 ], !dbg !34 103 104sw.bb: ; preds = %entry 105 store i32 10, i32* %retval, !dbg !35 106 br label %return, !dbg !35 107 108sw.bb1: ; preds = %entry 109 store i32 20, i32* %retval, !dbg !37 110 br label %return, !dbg !37 111 112sw.default: ; preds = %entry 113 store i32 30, i32* %retval, !dbg !38 114 br label %return, !dbg !38 115 116return: ; preds = %sw.default, %sw.bb1, %sw.bb 117 %1 = load i32, i32* %retval, !dbg !39 118 ret i32 %1, !dbg !39 119} 120 121attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 122attributes #1 = { nounwind readnone } 123 124!llvm.dbg.cu = !{!0} 125!llvm.module.flags = !{!11, !12, !13} 126!llvm.ident = !{!14} 127 128!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 (trunk)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) 129!1 = !DIFile(filename: "multiple.c", directory: "F:\5Cusers\5Cakaylor\5Cllvm-s\5Cllvm\5Ctest\5CJitListener") 130!2 = !{} 131!3 = !{!4, !9, !10} 132!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, variables: !2) 133!5 = !DIFile(filename: "multiple.c", directory: "F:CusersCakaylorCllvm-sCllvmCtestCJitListener") 134!6 = !DISubroutineType(types: !7) 135!7 = !{!8, !8} 136!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 137!9 = distinct !DISubprogram(name: "bar", line: 5, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !5, type: !6, variables: !2) 138!10 = distinct !DISubprogram(name: "fubar", line: 12, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 12, file: !1, scope: !5, type: !6, variables: !2) 139!11 = !{i32 2, !"Dwarf Version", i32 4} 140!12 = !{i32 2, !"Debug Info Version", i32 3} 141!13 = !{i32 1, !"PIC Level", i32 2} 142!14 = !{!"clang version 3.6.0 (trunk)"} 143!15 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !4, file: !5, type: !8) 144!16 = !DIExpression() 145!17 = !DILocation(line: 1, column: 13, scope: !4) 146!18 = !DILocation(line: 2, column: 10, scope: !4) 147!19 = !DILocation(line: 2, column: 3, scope: !4) 148!20 = !DILocalVariable(name: "a", line: 5, arg: 1, scope: !9, file: !5, type: !8) 149!21 = !DILocation(line: 5, column: 13, scope: !9) 150!22 = !DILocation(line: 6, column: 7, scope: !23) 151!23 = distinct !DILexicalBlock(line: 6, column: 7, file: !1, scope: !9) 152!24 = !DILocation(line: 6, column: 7, scope: !9) 153!25 = !DILocation(line: 7, column: 5, scope: !26) 154!26 = distinct !DILexicalBlock(line: 6, column: 15, file: !1, scope: !23) 155!27 = !DILocation(line: 9, column: 14, scope: !9) 156!28 = !DILocation(line: 9, column: 10, scope: !9) 157!29 = !DILocation(line: 9, column: 3, scope: !9) 158!30 = !DILocation(line: 10, column: 1, scope: !9) 159!31 = !DILocalVariable(name: "a", line: 12, arg: 1, scope: !10, file: !5, type: !8) 160!32 = !DILocation(line: 12, column: 15, scope: !10) 161!33 = !DILocation(line: 13, column: 11, scope: !10) 162!34 = !DILocation(line: 13, column: 3, scope: !10) 163!35 = !DILocation(line: 15, column: 7, scope: !36) 164!36 = distinct !DILexicalBlock(line: 13, column: 14, file: !1, scope: !10) 165!37 = !DILocation(line: 17, column: 7, scope: !36) 166!38 = !DILocation(line: 19, column: 7, scope: !36) 167!39 = !DILocation(line: 21, column: 1, scope: !10) 168