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