[llvm-bugs] [Bug 40688] New: [DebugInfo at O2] ADCE needlessly deletes dbg.values

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 11 02:36:36 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40688

            Bug ID: 40688
           Summary: [DebugInfo at O2] ADCE needlessly deletes dbg.values
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: CONFIRMED
          Keywords: wrong-debug
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: jeremy.morse.llvm at gmail.com
                CC: chackz0x12 at gmail.com, dblaikie at gmail.com,
                    greg.bedwell at sony.com,
                    international.phantom at gmail.com,
                    llvm-bugs at lists.llvm.org, paul.robinson at am.sony.com
            Blocks: 31268

With llvm at r353515, running 'opt -o - -S -adce" over the input IR below, the
dbg.value of %foo is dropped. This occurs even if I put the dbg.value above the
store, or put "arg: 1" in the DILocalVariable. AFAIK there's no reason for ADCE
to drop dbg.values when it doesn't drop any "real" IR instructions, and at the
very least it should leave a 'dbg.value(undef...)' in its place.

-------->8--------
target triple = "x86_64-unknown-linux-gnu"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

declare void @llvm.dbg.value(metadata, metadata, metadata)

define i32 @test(i32 *%foo) {
  store i32 0, i32 *%foo
  call void @llvm.dbg.value(metadata i32* %foo, metadata !1, metadata
!DIExpression()), !dbg !6
  ret i32 0
}

!llvm.module.flags = !{!4}
!llvm.dbg.cu = !{!2}
!1 = !DILocalVariable(name: "bees", scope: !5, type: !7)
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer:
"beards", isOptimized: true, runtimeVersion: 4, emissionKind: FullDebug)
!3 = !DIFile(filename: "bees.cpp", directory: "")
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = distinct !DISubprogram(name: "nope", scope: !2, file: !3, line: 1, unit:
!2)
!6 = !DILocation(line: 0, scope: !5)
!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
--------8<--------


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=31268
[Bug 31268] Umbrella: debug info for optimized code
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190211/427507d1/attachment.html>


More information about the llvm-bugs mailing list