1; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s 2 3; When an llvm.dbg.label intrinsic is extracted into a new function, make sure 4; that its metadata argument is a DILabel that points to a scope within the new 5; function. 6; 7; In this example, the label "bye" points to the scope for @foo before 8; splitting, and should point to the scope for @foo.cold.1 after splitting. 9 10target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 11target triple = "x86_64-apple-macosx10.14.0" 12 13; CHECK-LABEL: define {{.*}}@foo.cold.1 14; CHECK: #dbg_label([[LABEL:![0-9]+]], [[LINE:![0-9]+]] 15; CHECK: #dbg_label([[LABEL_IN_INLINE_ME:![0-9]+]], [[LINE2:![0-9]+]] 16; CHECK: #dbg_label([[SCOPED_LABEL:![0-9]+]], [[LINE]] 17 18; CHECK: [[FILE:![0-9]+]] = !DIFile 19; CHECK: [[INLINE_ME_SCOPE:![0-9]+]] = distinct !DISubprogram(name: "inline_me" 20; CHECK: [[SCOPE:![0-9]+]] = distinct !DISubprogram(name: "foo.cold.1" 21; CHECK: [[LABEL]] = !DILabel(scope: [[SCOPE]], name: "bye", file: [[FILE]], line: 28 22; CHECK: [[LINE]] = !DILocation(line: 1, column: 1, scope: [[SCOPE]] 23; CHECK: [[LABEL_IN_INLINE_ME]] = !DILabel(scope: [[INLINE_ME_SCOPE]], name: "label_in_@inline_me", file: [[FILE]], line: 29 24; CHECK: [[LINE2]] = !DILocation(line: 2, column: 2, scope: [[INLINE_ME_SCOPE]], inlinedAt: [[LINE]] 25; CHECK: [[SCOPED_LABEL]] = !DILabel(scope: [[SCOPE_IN_FOO:![0-9]+]], name: "scoped_label_in_foo", file: [[FILE]], line: 30 26; CHECK: [[SCOPE_IN_FOO]] = !DILexicalBlock(scope: [[SCOPE]], file: [[FILE]], line: 31, column: 31) 27 28define void @foo(i32 %arg1) !dbg !6 { 29entry: 30 %var = add i32 0, 0, !dbg !11 31 br i1 undef, label %if.then, label %if.end 32 33if.then: ; preds = %entry 34 ret void 35 36if.end: ; preds = %entry 37 call void @llvm.dbg.label(metadata !12), !dbg !11 38 call void @llvm.dbg.label(metadata !14), !dbg !15 39 call void @llvm.dbg.label(metadata !16), !dbg !11 40 call void @sink() 41 ret void 42} 43 44declare void @llvm.dbg.label(metadata) 45 46declare void @sink() cold 47 48define void @inline_me() !dbg !13 { 49 ret void 50} 51 52!llvm.dbg.cu = !{!0} 53!llvm.debugify = !{!3, !4} 54!llvm.module.flags = !{!5} 55 56!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 57!1 = !DIFile(filename: "<stdin>", directory: "/") 58!2 = !{} 59!3 = !{i32 7} 60!4 = !{i32 1} 61!5 = !{i32 2, !"Debug Info Version", i32 3} 62!6 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8) 63!7 = !DISubroutineType(types: !2) 64!8 = !{!9} 65!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10) 66!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) 67!11 = !DILocation(line: 1, column: 1, scope: !6) 68!12 = !DILabel(scope: !6, name: "bye", file: !1, line: 28) 69!13 = distinct !DISubprogram(name: "inline_me", linkageName: "inline_me", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8) 70!14 = !DILabel(scope: !13, name: "label_in_@inline_me", file: !1, line: 29) 71!15 = !DILocation(line: 2, column: 2, scope: !13, inlinedAt: !11) 72!16 = !DILabel(scope: !17, name: "scoped_label_in_foo", file: !1, line: 30) 73!17 = distinct !DILexicalBlock(scope: !6, file: !1, line: 31, column: 31) 74