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