Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s | FileCheck %s --check-prefix=ASM |
| 2 | ; RUN: llc < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF |
| 3 | |
| 4 | ; Values in registers should be clobbered by calls, which use a regmask instead |
| 5 | ; of individual register def operands. |
| 6 | |
| 7 | ; ASM: main: # @main |
| 8 | ; ASM: #DEBUG_VALUE: main:argc <- %ECX |
| 9 | ; ASM: movl $1, x(%rip) |
| 10 | ; ASM: callq clobber |
| 11 | ; ASM-NEXT: [[argc_range_end:.Ltmp[0-9]+]]: |
| 12 | ; Previously LiveDebugValues would claim argc was still in ECX after the call. |
| 13 | ; ASM-NOT: #DEBUG_VALUE: main:argc |
| 14 | |
| 15 | ; argc is the first debug location. |
| 16 | ; ASM: .Ldebug_loc1: |
| 17 | ; ASM-NEXT: .quad .Lfunc_begin0-.Lfunc_begin0 |
| 18 | ; ASM-NEXT: .quad [[argc_range_end]]-.Lfunc_begin0 |
| 19 | ; ASM-NEXT: .short 3 # Loc expr size |
| 20 | ; ASM-NEXT: .byte 82 # super-register DW_OP_reg2 |
| 21 | ; ASM-NEXT: .byte 147 # DW_OP_piece |
| 22 | ; ASM-NEXT: .byte 4 # 4 |
| 23 | |
| 24 | ; argc is the first formal parameter. |
| 25 | ; DWARF: .debug_info contents: |
| 26 | ; DWARF: DW_TAG_formal_parameter |
| 27 | ; DWARF-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[argc_loc_offset:0x.*]]) |
| 28 | ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] {{.*}} "argc" |
| 29 | |
| 30 | ; DWARF: .debug_loc contents: |
| 31 | ; DWARF: [[argc_loc_offset]]: Beginning address offset: 0x0000000000000000 |
| 32 | ; DWARF-NEXT: Ending address offset: 0x0000000000000013 |
| 33 | ; DWARF-NEXT: Location description: 52 93 04 |
| 34 | |
| 35 | ; ModuleID = 't.cpp' |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 36 | source_filename = "test/DebugInfo/X86/dbg-value-regmask-clobber.ll" |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 37 | target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" |
| 38 | target triple = "x86_64-pc-windows-msvc18.0.0" |
| 39 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 40 | @x = common global i32 0, align 4, !dbg !0 |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 41 | |
| 42 | ; Function Attrs: nounwind uwtable |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 43 | define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 !dbg !12 { |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 44 | entry: |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 45 | tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !19, metadata !21), !dbg !22 |
| 46 | tail call void @llvm.dbg.value(metadata i32 %argc, i64 0, metadata !20, metadata !21), !dbg !23 |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 47 | store volatile i32 1, i32* @x, align 4, !dbg !24, !tbaa !25 |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 48 | tail call void @clobber() #2, !dbg !29 |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 49 | store volatile i32 2, i32* @x, align 4, !dbg !30, !tbaa !25 |
| 50 | %0 = load volatile i32, i32* @x, align 4, !dbg !31, !tbaa !25 |
| 51 | %tobool = icmp eq i32 %0, 0, !dbg !31 |
| 52 | br i1 %tobool, label %if.else, label %if.then, !dbg !33 |
| 53 | |
| 54 | if.then: ; preds = %entry |
| 55 | store volatile i32 3, i32* @x, align 4, !dbg !34, !tbaa !25 |
| 56 | br label %if.end, !dbg !36 |
| 57 | |
| 58 | if.else: ; preds = %entry |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 59 | |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 60 | store volatile i32 4, i32* @x, align 4, !dbg !37, !tbaa !25 |
| 61 | br label %if.end |
| 62 | |
| 63 | if.end: ; preds = %if.else, %if.then |
| 64 | ret i32 0, !dbg !39 |
| 65 | } |
| 66 | |
| 67 | declare void @clobber() |
| 68 | |
| 69 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 70 | declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 71 | |
| 72 | attributes #0 = { nounwind uwtable } |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 73 | attributes #1 = { nounwind readnone } |
| 74 | attributes #2 = { nounwind } |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 75 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 76 | !llvm.dbg.cu = !{!2} |
| 77 | !llvm.module.flags = !{!8, !9, !10} |
| 78 | !llvm.ident = !{!11} |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 79 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 80 | !0 = !DIGlobalVariableExpression(var: !1) |
| 81 | !1 = !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true) |
| 82 | !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) |
| 83 | !3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild") |
| 84 | !4 = !{} |
| 85 | !5 = !{!0} |
| 86 | !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7) |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 87 | !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 88 | !8 = !{i32 2, !"Dwarf Version", i32 4} |
| 89 | !9 = !{i32 2, !"Debug Info Version", i32 3} |
| 90 | !10 = !{i32 1, !"PIC Level", i32 2} |
| 91 | !11 = !{!"clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)"} |
| 92 | !12 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 4, type: !13, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !18) |
| 93 | !13 = !DISubroutineType(types: !14) |
| 94 | !14 = !{!7, !7, !15} |
| 95 | !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64) |
| 96 | !16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 64, align: 64) |
| 97 | !17 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) |
| 98 | !18 = !{!19, !20} |
| 99 | !19 = !DILocalVariable(name: "argv", arg: 2, scope: !12, file: !3, line: 4, type: !15) |
| 100 | !20 = !DILocalVariable(name: "argc", arg: 1, scope: !12, file: !3, line: 4, type: !7) |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 101 | !21 = !DIExpression() |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 102 | !22 = !DILocation(line: 4, column: 27, scope: !12) |
| 103 | !23 = !DILocation(line: 4, column: 14, scope: !12) |
| 104 | !24 = !DILocation(line: 5, column: 5, scope: !12) |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 105 | !25 = !{!26, !26, i64 0} |
| 106 | !26 = !{!"int", !27, i64 0} |
| 107 | !27 = !{!"omnipotent char", !28, i64 0} |
| 108 | !28 = !{!"Simple C/C++ TBAA"} |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 109 | !29 = !DILocation(line: 6, column: 3, scope: !12) |
| 110 | !30 = !DILocation(line: 7, column: 5, scope: !12) |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 111 | !31 = !DILocation(line: 8, column: 7, scope: !32) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 112 | !32 = distinct !DILexicalBlock(scope: !12, file: !3, line: 8, column: 7) |
| 113 | !33 = !DILocation(line: 8, column: 7, scope: !12) |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 114 | !34 = !DILocation(line: 9, column: 7, scope: !35) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 115 | !35 = distinct !DILexicalBlock(scope: !32, file: !3, line: 8, column: 10) |
Reid Kleckner | f6f04f8 | 2016-03-25 17:54:46 +0000 | [diff] [blame] | 116 | !36 = !DILocation(line: 10, column: 3, scope: !35) |
| 117 | !37 = !DILocation(line: 11, column: 7, scope: !38) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 118 | !38 = distinct !DILexicalBlock(scope: !32, file: !3, line: 10, column: 10) |
| 119 | !39 = !DILocation(line: 13, column: 1, scope: !12) |
| 120 | |