1 ; RUN: opt -jmc-instrumenter -mtriple=x86_64-unknown-linux-gnu -S < %s | FileCheck %s
2 ; RUN: opt -passes=jmc-instrumenter -mtriple=x86_64-unknown-linux-gnu -S < %s | FileCheck %s
4 ; CHECK: @"__7DF23CF5_x@c" = internal unnamed_addr global i8 1, section ".data.just.my.code", align 1, !dbg !0
5 ; CHECK: @"__A8764FDD_x@c" = internal unnamed_addr global i8 1, section ".data.just.my.code", align 1, !dbg !5
7 ; CHECK: define void @l1() !dbg !12 {
8 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__7DF23CF5_x@c")
12 ; CHECK: define void @l2() !dbg !16 {
13 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__7DF23CF5_x@c")
17 ; CHECK: define void @w1() !dbg !18 {
18 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
22 ; CHECK: define void @w2() !dbg !19 {
23 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
27 ; CHECK: define void @w3() !dbg !21 {
28 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
32 ; CHECK: define void @w4() !dbg !23 {
33 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
37 ; CHECK: define weak void @__CheckForDebuggerJustMyCode(ptr noundef %0) unnamed_addr {
41 ; CHECK: !llvm.dbg.cu = !{!2}
42 ; CHECK: !llvm.module.flags = !{!9, !10}
43 ; CHECK: !llvm.ident = !{!11}
45 ; CHECK: !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
46 ; CHECK: !1 = distinct !DIGlobalVariable(name: "__7DF23CF5_x@c", scope: !2, file: !3, type: !8, isLocal: true, isDefinition: true)
47 ; CHECK: !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
48 ; CHECK: !3 = !DIFile(filename: "a/x.c", directory: "/tmp")
49 ; CHECK: !4 = !{!0, !5}
50 ; CHECK: !5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
51 ; CHECK: !6 = distinct !DIGlobalVariable(name: "__A8764FDD_x@c", scope: !2, file: !7, type: !8, isLocal: true, isDefinition: true)
52 ; CHECK: !7 = !DIFile(filename: "./x.c", directory: "C:\\\\a\\\\b\\\\")
53 ; CHECK: !8 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char, flags: DIFlagArtificial)
54 ; CHECK: !9 = !{i32 2, !"CodeView", i32 1}
55 ; CHECK: !10 = !{i32 2, !"Debug Info Version", i32 3}
56 ; CHECK: !11 = !{!"clang"}
57 ; CHECK: !12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
58 ; CHECK: !13 = !DISubroutineType(types: !14)
59 ; CHECK: !14 = !{null}
61 ; CHECK: !16 = distinct !DISubprogram(name: "f", scope: !17, file: !17, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
62 ; CHECK: !17 = !DIFile(filename: "x.c", directory: "/tmp/a")
63 ; CHECK: !18 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
64 ; CHECK: !19 = distinct !DISubprogram(name: "f", scope: !20, file: !20, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
65 ; CHECK: !20 = !DIFile(filename: "./b\\x.c", directory: "C:\\\\a\\\\")
66 ; CHECK: !21 = distinct !DISubprogram(name: "f", scope: !22, file: !22, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
67 ; CHECK: !22 = !DIFile(filename: "./b/x.c", directory: "C:\\\\a\\\\")
68 ; CHECK: !23 = distinct !DISubprogram(name: "f", scope: !24, file: !24, line: 1, type: !13, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
69 ; CHECK: !24 = !DIFile(filename: "./b/./../b/x.c", directory: "C:\\\\a")
71 ; All use the same flag
72 define void @l1() !dbg !10 {
75 define void @l2() !dbg !11 {
79 ; All use the same flag
80 define void @w1() !dbg !12 {
83 define void @w2() !dbg !13 {
86 define void @w3() !dbg !14 {
89 define void @w4() !dbg !15 {
94 !llvm.module.flags = !{!7, !8}
97 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
98 !1 = !DIFile(filename: "a/x.c", directory: "/tmp")
99 !2 = !DIFile(filename: "x.c", directory: "/tmp/a")
100 !3 = !DIFile(filename: "./x.c", directory: "C:\\\\a\\\\b\\\\")
101 !4 = !DIFile(filename: "./b\\x.c", directory: "C:\\\\a\\\\")
102 !5 = !DIFile(filename: "./b/x.c", directory: "C:\\\\a\\\\")
103 !6 = !DIFile(filename: "./b/./../b/x.c", directory: "C:\\\\a")
104 !7 = !{i32 2, !"CodeView", i32 1}
105 !8 = !{i32 2, !"Debug Info Version", i32 3}
107 !10 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
108 !11 = distinct !DISubprogram(name: "f", scope: !2, file: !2, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
109 !12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
110 !13 = distinct !DISubprogram(name: "f", scope: !4, file: !4, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
111 !14 = distinct !DISubprogram(name: "f", scope: !5, file: !5, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
112 !15 = distinct !DISubprogram(name: "f", scope: !6, file: !6, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
113 !31 = !DISubroutineType(types: !32)