[llvm-bugs] [Bug 26587] New: Bit-Tracking Dead Code Elimination appears to destroy llvm.dbg.value's argument

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 11 17:24:08 PST 2016


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

            Bug ID: 26587
           Summary: Bit-Tracking Dead Code Elimination appears to destroy
                    llvm.dbg.value's argument
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: aprantl at apple.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Found in r260628.

Compiling the following example with -O -mllvm -print-after-all:

void h();
int g();
void f() {
  h();
  int a = g();
  h();
}

*** IR Dump After Demanded bits analysis ***
; Function Attrs: nounwind ssp uwtable
define void @f() #0 !dbg !4 {
entry:
  tail call void (...) @h() #4, !dbg !14
  %call = tail call i32 (...) @g() #4, !dbg !15
  tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !8,
metadata !16), !dbg !17
  tail call void (...) @h() #4, !dbg !18
  ret void, !dbg !19
}
*** IR Dump After Bit-Tracking Dead Code Elimination ***
; Function Attrs: nounwind ssp uwtable
define void @f() #0 !dbg !4 {
entry:
  tail call void (...) @h() #4, !dbg !14
  %call = tail call i32 (...) @g() #4, !dbg !15
  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !8, metadata
!16), !dbg !17
                                          ^^^^^
  tail call void (...) @h() #4, !dbg !18
  ret void, !dbg !19
}

which then causes the debug info to present "a" as a constant zero.

0x0000004a:         TAG_variable [3]  
                     AT_const_value( 0x0000000000000000 )
                     AT_name( "a" )
                     AT_decl_file( "/Volumes/Data/llvm/test.c" )
                     AT_decl_line( 5 )
                     AT_type( {0x00000057} ( int ) )

-- 
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/20160212/14630168/attachment-0001.html>


More information about the llvm-bugs mailing list