[llvm-bugs] [Bug 39896] New: Lowering loses information about debug variable assignment.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 5 09:02:09 PST 2018


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

            Bug ID: 39896
           Summary: Lowering loses information about debug variable
                    assignment.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Keywords: wrong-debug
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: carlos.alberto.enciso at gmail.com,
                    greg.bedwell at sony.com, jdevlieghere at apple.com,
                    jeremy.morse.llvm at gmail.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

Created attachment 21196
  --> https://bugs.llvm.org/attachment.cgi?id=21196&action=edit
testcase

The following IR debug instruction/metadata (please see attachment for the full
file):

@a = global i8 25, align 1, !dbg !0

; Function Attrs: nounwind ssp uwtable
define signext i16 @b() #0 !dbg !12 {
entry:
  call void @llvm.dbg.value(metadata i16 23680, metadata !17, metadata
!DIExpression()), !dbg !18
  %0 = load i8, i8* @a, align 1, !dbg !19, !tbaa !20
  %conv = sext i8 %0 to i16, !dbg !19
  call void @llvm.dbg.value(metadata i16 %conv, metadata !17, metadata
!DIExpression()), !dbg !18
  %call = call i32 (...) @optimize_me_not(), !dbg !23
  %1 = load i8, i8* @a, align 1, !dbg !24, !tbaa !20
  %conv1 = sext i8 %1 to i16, !dbg !24
  ret i16 %conv1, !dbg !25
}


Gets lowered into:

$ ./llc -filetype=obj ./baciotto.ll -o Palatino
$ dwarfdump ./patatino

[…]

0x00000046:     TAG_subprogram [4] *
                 AT_low_pc( 0x0000000000000000 )
                 AT_high_pc( 0x00000014 )
                 AT_frame_base( rbp )
                Unknown DW_AT constant: 0x7a( true )
                 AT_name( "b" )
                 AT_decl_file( "/Users/dcci/work/llvm/build-debug/bin/run.c" )
                 AT_decl_line( 2 )
                 AT_type( {0x00000095} ( short ) )
                 AT_external( true )
                 AT_APPLE_optimized( true )

0x0000005f:         TAG_variable [5]  
                     AT_const_value( 0x0000000000005c80 )
                     AT_name( "i" )
                     AT_decl_file(
"/Users/dcci/work/llvm/build-debug/bin/run.c" )
                     AT_decl_line( 3 )
                     AT_type( {0x00000095} ( short ) )

0x0000006d:         NULL

Somehow, somewhere in the backend or in MC we loose track that the variable
gets reassigned to the value loaded from the global @a. This degrades the debug
info quality, printing the wrong value.

-- 
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/20181205/5be32054/attachment.html>


More information about the llvm-bugs mailing list