[LLVMbugs] [Bug 10176] New: reassociate corrupts debug info

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 23 08:15:06 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10176

           Summary: reassociate corrupts debug info
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: gohman at apple.com
                CC: llvmbugs at cs.uiuc.edu


On this C testcase:

long foo(long a, long b, long c) {
  long d = c + b;
  return d + a;
}

clang -O2 -g produces this output (edited for clarity):

  tail call void @llvm.dbg.value(metadata !{i64 %add}, i64 0, metadata !9)
  %add = add i64 %b, %a
  %add4 = add i64 %add, %c
  ret i64 %add4
[...]
!9 = metadata !{i32 590080, metadata !10, metadata !"d", metadata !2, i32 2,
metadata !5, i32 0} ; [ DW_TAG_auto_variable ]

This says that the variable "d" has the value of %add. This is actively wrong,
because %add is b+a, not c+b.

To be conservatively correct within the current system, any pass which modifies
instructions in place (reassociate, in this case) should also search for
@llvm.dbg.value calls that reference instructions to be modified, and delete
them.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list