xref: /llvm-project/llvm/test/DebugInfo/ARM/move-dbg-values-imm-test.mir (revision 7fde0b2fa16b9677895441f28c0c0828f6a81c60)
1# RUN: llc -O2 %s -start-after=arm-mve-vpt-opts -stop-after=arm-prera-ldst-opt -o -  | FileCheck %s
2# CHECK: DBG_VALUE 13, $noreg, !11, !DIExpression(), debug-location !13
3
4
5# This test checks to make sure that a DBG_VALUE that uses an immediate doesn't get zero-ed out by a DBG_VALUE that comes later in the basic block, and describes the same variable.
6
7--- |
8  ; ModuleID = '/Users/shubham/Development/llvm-project/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll'
9  source_filename = "/Users/shubham/Development/llvm-project/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll"
10  target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
11  target triple = "armv8-unknown-linux"
12
13  ; Function Attrs: uwtable
14  define i32 @main() !dbg !6 {
15  entry:
16    %c = alloca i32, align 4
17    tail call void @llvm.dbg.value(metadata i32 13, metadata !11, metadata !DIExpression()), !dbg !13
18    store volatile i32 13, ptr %c, align 4, !dbg !14
19    %call = tail call i32 @_Z4funcv(), !dbg !15
20    tail call void @llvm.dbg.value(metadata i32 %call, metadata !11, metadata !DIExpression()), !dbg !13
21    store volatile i32 %call, ptr %c, align 4, !dbg !15
22    tail call void @llvm.dbg.value(metadata ptr %c, metadata !11, metadata !DIExpression(DW_OP_deref)), !dbg !13
23    %c.0.c.0. = load volatile i32, ptr %c, align 4, !dbg !16
24    ret i32 %c.0.c.0., !dbg !16
25  }
26
27  declare i32 @_Z4funcv()
28
29  declare void @llvm.dbg.value(metadata, metadata, metadata)
30
31  !llvm.dbg.cu = !{!0}
32  !llvm.module.flags = !{!3, !4}
33  !llvm.ident = !{!5}
34
35  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.6.0 (trunk 223522)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
36  !1 = !DIFile(filename: "test.cpp", directory: "/home/kromanova/ngh/ToT_latest/llvm/test/DebugInfo")
37  !2 = !{}
38  !3 = !{i32 2, !"Dwarf Version", i32 2}
39  !4 = !{i32 2, !"Debug Info Version", i32 3}
40  !5 = !{!"clang version 3.6.0 (trunk 223522)"}
41  !6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !7, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
42  !7 = !DISubroutineType(types: !8)
43  !8 = !{!9}
44  !9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
45  !10 = !{!11}
46  !11 = !DILocalVariable(name: "c", scope: !6, file: !1, line: 5, type: !12)
47  !12 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !9)
48  !13 = !DILocation(line: 5, column: 16, scope: !6)
49  !14 = !DILocation(line: 5, column: 3, scope: !6)
50  !15 = !DILocation(line: 6, column: 7, scope: !6)
51  !16 = !DILocation(line: 7, column: 3, scope: !6)
52
53...
54---
55name:            main
56alignment:       4
57exposesReturnsTwice: false
58legalized:       false
59regBankSelected: false
60selected:        false
61failedISel:      false
62tracksRegLiveness: true
63hasWinCFI:       false
64callsEHReturn:   false
65callsUnwindInit: false
66hasEHCatchret:   false
67hasEHScopes:     false
68hasEHFunclets:   false
69isOutlined:      false
70debugInstrRef:   false
71failsVerification: false
72tracksDebugUserValues: false
73registers:
74  - { id: 0, class: gpr, preferred-register: '' }
75  - { id: 1, class: gpr, preferred-register: '' }
76  - { id: 2, class: gpr, preferred-register: '' }
77liveins:         []
78frameInfo:
79  isFrameAddressTaken: false
80  isReturnAddressTaken: false
81  hasStackMap:     false
82  hasPatchPoint:   false
83  stackSize:       0
84  offsetAdjustment: 0
85  maxAlignment:    4
86  adjustsStack:    true
87  hasCalls:        true
88  stackProtector:  ''
89  functionContext: ''
90  maxCallFrameSize: 0
91  cvBytesOfCalleeSavedRegisters: 0
92  hasOpaqueSPAdjustment: false
93  hasVAStart:      false
94  hasMustTailInVarArgFunc: false
95  hasTailCall:     false
96  localFrameSize:  4
97  savePoint:       ''
98  restorePoint:    ''
99fixedStack:      []
100stack:
101  - { id: 0, name: c, type: default, offset: 0, size: 4, alignment: 4,
102      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
103      local-offset: -4, debug-info-variable: '', debug-info-expression: '',
104      debug-info-location: '' }
105callSites:       []
106debugValueSubstitutions: []
107constants:       []
108machineFunctionInfo: {}
109body:             |
110  bb.0.entry:
111    DBG_VALUE 13, $noreg, !11, !DIExpression(), debug-location !13
112    %0:gpr = MOVi 13, 14 /* CC::al */, $noreg, $noreg
113    STRi12 killed %0, %stack.0.c, 0, 14 /* CC::al */, $noreg, debug-location !14 :: (volatile store (s32) into %ir.c)
114    ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp, debug-location !15
115    BL @_Z4funcv, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $r0, debug-location !15
116    ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp, debug-location !15
117    %1:gpr = COPY $r0, debug-location !15
118    DBG_VALUE %1, $noreg, !11, !DIExpression(), debug-location !13
119    STRi12 %1, %stack.0.c, 0, 14 /* CC::al */, $noreg, debug-location !15 :: (volatile store (s32) into %ir.c)
120    DBG_VALUE %stack.0.c, $noreg, !11, !DIExpression(DW_OP_deref), debug-location !13
121    %2:gpr = LDRi12 %stack.0.c, 0, 14 /* CC::al */, $noreg, debug-location !16 :: (volatile dereferenceable load (s32) from %ir.c)
122    $r0 = COPY %2, debug-location !16
123    BX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !16
124
125...
126