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
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.
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"
13 ; Function Attrs: uwtable
14 define i32 @main() !dbg !6 {
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
27 declare i32 @_Z4funcv()
29 declare void @llvm.dbg.value(metadata, metadata, metadata)
32 !llvm.module.flags = !{!3, !4}
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")
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)
44 !9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
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)
57 exposesReturnsTwice: false
59 regBankSelected: false
62 tracksRegLiveness: true
65 callsUnwindInit: false
71 failsVerification: false
72 tracksDebugUserValues: false
74 - { id: 0, class: gpr, preferred-register: '' }
75 - { id: 1, class: gpr, preferred-register: '' }
76 - { id: 2, class: gpr, preferred-register: '' }
79 isFrameAddressTaken: false
80 isReturnAddressTaken: false
91 cvBytesOfCalleeSavedRegisters: 0
92 hasOpaqueSPAdjustment: false
94 hasMustTailInVarArgFunc: false
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: '' }
106 debugValueSubstitutions: []
108 machineFunctionInfo: {}
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