1; RUN: opt -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: llvm.dbg.label(metadata [[LABEL:![0-9]+]]), !dbg [[LINE:![0-9]+]] 15 16; CHECK: [[FILE:![0-9]+]] = !DIFile 17; CHECK: [[SCOPE:![0-9]+]] = distinct !DISubprogram(name: "foo.cold.1" 18; CHECK: [[LINE]] = !DILocation(line: 1, column: 1, scope: [[SCOPE]] 19; CHECK: [[LABEL]] = !DILabel(scope: [[SCOPE]], name: "bye", file: [[FILE]], line: 28 20 21define void @foo(i32 %arg1) !dbg !6 { 22entry: 23 %var = add i32 0, 0, !dbg !11 24 br i1 undef, label %if.then, label %if.end 25 26if.then: ; preds = %entry 27 ret void 28 29if.end: ; preds = %entry 30 call void @llvm.dbg.label(metadata !12), !dbg !11 31 call void @sink() 32 ret void 33} 34 35declare void @llvm.dbg.label(metadata) 36 37declare void @sink() cold 38 39!llvm.dbg.cu = !{!0} 40!llvm.debugify = !{!3, !4} 41!llvm.module.flags = !{!5} 42 43!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 44!1 = !DIFile(filename: "<stdin>", directory: "/") 45!2 = !{} 46!3 = !{i32 7} 47!4 = !{i32 1} 48!5 = !{i32 2, !"Debug Info Version", i32 3} 49!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) 50!7 = !DISubroutineType(types: !2) 51!8 = !{!9} 52!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10) 53!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) 54!11 = !DILocation(line: 1, column: 1, scope: !6) 55!12 = !DILabel(scope: !6, name: "bye", file: !1, line: 28) 56