Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; RUN: opt -hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 4 | target triple = "x86_64-apple-macosx10.14.0" |
| 5 | |
| 6 | ; CHECK-LABEL: define {{.*}}@foo( |
| 7 | ; CHECK-NOT: call {{.*}}llvm.dbg.value |
| 8 | |
| 9 | ; CHECK-LABEL: define {{.*}}@foo.cold |
| 10 | ; CHECK-NOT: call {{.*}}llvm.dbg.value |
| 11 | |
| 12 | define void @foo() !dbg !6 { |
| 13 | entry: |
| 14 | br i1 undef, label %if.then, label %if.end |
| 15 | |
| 16 | if.then: ; preds = %entry |
| 17 | br label %cleanup |
| 18 | |
| 19 | if.end: ; preds = %entry |
| 20 | ; We expect this block to be outlined. That kills the definition of %var. |
| 21 | %var = add i32 0, 0, !dbg !11 |
| 22 | call void @sink() |
| 23 | br label %cleanup |
| 24 | |
| 25 | cleanup: |
| 26 | ; This dbg.value should be deleted after outlining, otherwise the verifier |
| 27 | ; complains about function-local metadata being used outside of a function. |
| 28 | call void @llvm.dbg.value(metadata i32 %var, metadata !9, metadata !DIExpression()), !dbg !11 |
| 29 | ret void |
| 30 | } |
| 31 | |
| 32 | declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 33 | |
| 34 | declare void @sink() cold |
| 35 | |
| 36 | !llvm.dbg.cu = !{!0} |
| 37 | !llvm.debugify = !{!3, !4} |
| 38 | !llvm.module.flags = !{!5} |
| 39 | |
| 40 | !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) |
| 41 | !1 = !DIFile(filename: "<stdin>", directory: "/") |
| 42 | !2 = !{} |
| 43 | !3 = !{i32 7} |
| 44 | !4 = !{i32 1} |
| 45 | !5 = !{i32 2, !"Debug Info Version", i32 3} |
| 46 | !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) |
| 47 | !7 = !DISubroutineType(types: !2) |
| 48 | !8 = !{!9} |
| 49 | !9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10) |
| 50 | !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) |
| 51 | !11 = !DILocation(line: 1, column: 1, scope: !6) |