# RUN: llc -O2 %s -start-after=arm-mve-vpt-opts -stop-after=arm-prera-ldst-opt -o - | FileCheck %s # CHECK: DBG_VALUE 13, $noreg, !11, !DIExpression(), debug-location !13 # 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. --- | ; ModuleID = '/Users/shubham/Development/llvm-project/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll' source_filename = "/Users/shubham/Development/llvm-project/llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll" target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "armv8-unknown-linux" ; Function Attrs: uwtable define i32 @main() !dbg !6 { entry: %c = alloca i32, align 4 tail call void @llvm.dbg.value(metadata i32 13, metadata !11, metadata !DIExpression()), !dbg !13 store volatile i32 13, ptr %c, align 4, !dbg !14 %call = tail call i32 @_Z4funcv(), !dbg !15 tail call void @llvm.dbg.value(metadata i32 %call, metadata !11, metadata !DIExpression()), !dbg !13 store volatile i32 %call, ptr %c, align 4, !dbg !15 tail call void @llvm.dbg.value(metadata ptr %c, metadata !11, metadata !DIExpression(DW_OP_deref)), !dbg !13 %c.0.c.0. = load volatile i32, ptr %c, align 4, !dbg !16 ret i32 %c.0.c.0., !dbg !16 } declare i32 @_Z4funcv() declare void @llvm.dbg.value(metadata, metadata, metadata) !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3, !4} !llvm.ident = !{!5} !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) !1 = !DIFile(filename: "test.cpp", directory: "/home/kromanova/ngh/ToT_latest/llvm/test/DebugInfo") !2 = !{} !3 = !{i32 2, !"Dwarf Version", i32 2} !4 = !{i32 2, !"Debug Info Version", i32 3} !5 = !{!"clang version 3.6.0 (trunk 223522)"} !6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !7, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10) !7 = !DISubroutineType(types: !8) !8 = !{!9} !9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !10 = !{!11} !11 = !DILocalVariable(name: "c", scope: !6, file: !1, line: 5, type: !12) !12 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !9) !13 = !DILocation(line: 5, column: 16, scope: !6) !14 = !DILocation(line: 5, column: 3, scope: !6) !15 = !DILocation(line: 6, column: 7, scope: !6) !16 = !DILocation(line: 7, column: 3, scope: !6) ... --- name: main alignment: 4 exposesReturnsTwice: false legalized: false regBankSelected: false selected: false failedISel: false tracksRegLiveness: true hasWinCFI: false callsEHReturn: false callsUnwindInit: false hasEHCatchret: false hasEHScopes: false hasEHFunclets: false isOutlined: false debugInstrRef: false failsVerification: false tracksDebugUserValues: false registers: - { id: 0, class: gpr, preferred-register: '' } - { id: 1, class: gpr, preferred-register: '' } - { id: 2, class: gpr, preferred-register: '' } liveins: [] frameInfo: isFrameAddressTaken: false isReturnAddressTaken: false hasStackMap: false hasPatchPoint: false stackSize: 0 offsetAdjustment: 0 maxAlignment: 4 adjustsStack: true hasCalls: true stackProtector: '' functionContext: '' maxCallFrameSize: 0 cvBytesOfCalleeSavedRegisters: 0 hasOpaqueSPAdjustment: false hasVAStart: false hasMustTailInVarArgFunc: false hasTailCall: false localFrameSize: 4 savePoint: '' restorePoint: '' fixedStack: [] stack: - { id: 0, name: c, type: default, offset: 0, size: 4, alignment: 4, stack-id: default, callee-saved-register: '', callee-saved-restored: true, local-offset: -4, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } callSites: [] debugValueSubstitutions: [] constants: [] machineFunctionInfo: {} body: | bb.0.entry: DBG_VALUE 13, $noreg, !11, !DIExpression(), debug-location !13 %0:gpr = MOVi 13, 14 /* CC::al */, $noreg, $noreg STRi12 killed %0, %stack.0.c, 0, 14 /* CC::al */, $noreg, debug-location !14 :: (volatile store (s32) into %ir.c) ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp, debug-location !15 BL @_Z4funcv, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def $r0, debug-location !15 ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp, debug-location !15 %1:gpr = COPY $r0, debug-location !15 DBG_VALUE %1, $noreg, !11, !DIExpression(), debug-location !13 STRi12 %1, %stack.0.c, 0, 14 /* CC::al */, $noreg, debug-location !15 :: (volatile store (s32) into %ir.c) DBG_VALUE %stack.0.c, $noreg, !11, !DIExpression(DW_OP_deref), debug-location !13 %2:gpr = LDRi12 %stack.0.c, 0, 14 /* CC::al */, $noreg, debug-location !16 :: (volatile dereferenceable load (s32) from %ir.c) $r0 = COPY %2, debug-location !16 BX_RET 14 /* CC::al */, $noreg, implicit $r0, debug-location !16 ...