[llvm-bugs] [Bug 27629] New: LiveDebugValues missing propagation of debug info across bb boundaries

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 3 16:07:48 PDT 2016


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

            Bug ID: 27629
           Summary: LiveDebugValues missing propagation of debug info
                    across bb boundaries
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: warren_ristow at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The test case listed at the end of this comment shows a degradation in
debug-info quality when compiled at '-O1 -g', when moving from llvm 3.7 to
llvm 3.8.

When using llvm 3.7, the variable 'ptr' can be examined at the two lines
with the comment "set a breakpoint here", but with llvm 3.8, 'ptr' is no
longer visible on those lines, because the needed DBG_VALUE instructions
haven't been inserted by the LiveDebugValues pass.  (Also tested with modern
TOT, r268454, and the behavior is the same as llvm 3.8.)

In looking at it, I believe the problem is a bug in the data flow analysis
done in the (relatively new) LiveDebugValues pass.

Note that when the LiveDebugValues pass was first committed (r255759), the
debug-quality for 'ptr' was still "good" at '-O1 -g'.  The poor visibility
of 'ptr' first appeared in r256188, when a change was made to the related
LiveDebugVariables analysis.  Regarding r256188, this was to fix the issue
of bug 24563 (LiveDebugVariables unconditionally propagates all DBG_VALUEs).
In that change, it was noted that with the recent data flow analysis of the
LiveDebugValues pass (which runs after LiveDebugVariables), the propagation
being done by LiveDebugVariables was redundant, and could be removed. I
believe that's the correct approach, but I think there was a latent bug in
the data flow analysis of LiveDebugValues that was exposed when that
propagation was removed from LiveDebugVariables, causing the problem
described here.

/* ============================== "test.c" ============================== */
/* Compile as:
 *
 *      clang -c -O1 -g test.c
 *
 * and check the visiblilty of 'ptr' in llvm3.7 vs llvm3.8 at lines with
 * the 'set a breakpoint here' comment.
 */
struct A {
  int i;
  float f;
};

extern void foo(struct A *ptr, int lim);
extern int use(int i);

void foo(struct A *ptr, int lim)
{
  int i;
  for (i = 0; i < lim; ++i) {
    if (i > lim/2) {
      ptr->i += 2*use(i);       // set a breakpoint here, and examine 'ptr'
    } else {
      ptr->i += use(i);         // set a breakpoint here, and examine 'ptr'
    }
  }
}
/* ====================================================================== */

-- 
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/20160503/4a62f5d9/attachment.html>


More information about the llvm-bugs mailing list