]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/DebugInfo/X86/dbg-value-regmask-clobber.ll
Vendor import of llvm trunk r300422:
[FreeBSD/FreeBSD.git] / test / DebugInfo / X86 / dbg-value-regmask-clobber.ll
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  1                       # Loc expr size
20 ; ASM-NEXT: .byte   82                      # super-register DW_OP_reg2
21
22 ; argc is the first formal parameter.
23 ; DWARF: .debug_info contents:
24 ; DWARF:  DW_TAG_formal_parameter
25 ; DWARF-NEXT:    DW_AT_location [DW_FORM_sec_offset]   ([[argc_loc_offset:0x.*]])
26 ; DWARF-NEXT:    DW_AT_name [DW_FORM_strp]     {{.*}} "argc"
27
28 ; DWARF: .debug_loc contents:
29 ; DWARF: [[argc_loc_offset]]: Beginning address offset: 0x0000000000000000
30 ; DWARF-NEXT:                    Ending address offset: 0x0000000000000013
31 ; DWARF-NEXT:                     Location description: 52
32
33 ; ModuleID = 't.cpp'
34 source_filename = "test/DebugInfo/X86/dbg-value-regmask-clobber.ll"
35 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
36 target triple = "x86_64-pc-windows-msvc18.0.0"
37
38 @x = common global i32 0, align 4, !dbg !0
39
40 ; Function Attrs: nounwind uwtable
41 define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 !dbg !12 {
42 entry:
43   tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !19, metadata !21), !dbg !22
44   tail call void @llvm.dbg.value(metadata i32 %argc, i64 0, metadata !20, metadata !21), !dbg !23
45   store volatile i32 1, i32* @x, align 4, !dbg !24, !tbaa !25
46   tail call void @clobber() #2, !dbg !29
47   store volatile i32 2, i32* @x, align 4, !dbg !30, !tbaa !25
48   %0 = load volatile i32, i32* @x, align 4, !dbg !31, !tbaa !25
49   %tobool = icmp eq i32 %0, 0, !dbg !31
50   br i1 %tobool, label %if.else, label %if.then, !dbg !33
51
52 if.then:                                          ; preds = %entry
53   store volatile i32 3, i32* @x, align 4, !dbg !34, !tbaa !25
54   br label %if.end, !dbg !36
55
56 if.else:                                          ; preds = %entry
57
58   store volatile i32 4, i32* @x, align 4, !dbg !37, !tbaa !25
59   br label %if.end
60
61 if.end:                                           ; preds = %if.else, %if.then
62   ret i32 0, !dbg !39
63 }
64
65 declare void @clobber()
66
67 ; Function Attrs: nounwind readnone
68 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
69
70 attributes #0 = { nounwind uwtable }
71 attributes #1 = { nounwind readnone }
72 attributes #2 = { nounwind }
73
74 !llvm.dbg.cu = !{!2}
75 !llvm.module.flags = !{!8, !9, !10}
76 !llvm.ident = !{!11}
77
78 !0 = !DIGlobalVariableExpression(var: !1)
79 !1 = !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
80 !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)
81 !3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
82 !4 = !{}
83 !5 = !{!0}
84 !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
85 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
86 !8 = !{i32 2, !"Dwarf Version", i32 4}
87 !9 = !{i32 2, !"Debug Info Version", i32 3}
88 !10 = !{i32 1, !"PIC Level", i32 2}
89 !11 = !{!"clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)"}
90 !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)
91 !13 = !DISubroutineType(types: !14)
92 !14 = !{!7, !7, !15}
93 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64)
94 !16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !17, size: 64, align: 64)
95 !17 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
96 !18 = !{!19, !20}
97 !19 = !DILocalVariable(name: "argv", arg: 2, scope: !12, file: !3, line: 4, type: !15)
98 !20 = !DILocalVariable(name: "argc", arg: 1, scope: !12, file: !3, line: 4, type: !7)
99 !21 = !DIExpression()
100 !22 = !DILocation(line: 4, column: 27, scope: !12)
101 !23 = !DILocation(line: 4, column: 14, scope: !12)
102 !24 = !DILocation(line: 5, column: 5, scope: !12)
103 !25 = !{!26, !26, i64 0}
104 !26 = !{!"int", !27, i64 0}
105 !27 = !{!"omnipotent char", !28, i64 0}
106 !28 = !{!"Simple C/C++ TBAA"}
107 !29 = !DILocation(line: 6, column: 3, scope: !12)
108 !30 = !DILocation(line: 7, column: 5, scope: !12)
109 !31 = !DILocation(line: 8, column: 7, scope: !32)
110 !32 = distinct !DILexicalBlock(scope: !12, file: !3, line: 8, column: 7)
111 !33 = !DILocation(line: 8, column: 7, scope: !12)
112 !34 = !DILocation(line: 9, column: 7, scope: !35)
113 !35 = distinct !DILexicalBlock(scope: !32, file: !3, line: 8, column: 10)
114 !36 = !DILocation(line: 10, column: 3, scope: !35)
115 !37 = !DILocation(line: 11, column: 7, scope: !38)
116 !38 = distinct !DILexicalBlock(scope: !32, file: !3, line: 10, column: 10)
117 !39 = !DILocation(line: 13, column: 1, scope: !12)
118