[llvm-bugs] [Bug 38815] New: [DebugInfo at O2][Dexter] Loop strength reduction preserves little debug info

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 3 09:49:07 PDT 2018


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

            Bug ID: 38815
           Summary: [DebugInfo at O2][Dexter] Loop strength reduction
                    preserves little debug info
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: wrong-debug
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jeremy.morse.llvm at gmail.com
                CC: chackz0x12 at gmail.com, greg.bedwell at sony.com,
                    international.phantom at gmail.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com
            Blocks: 38768

It seems the loop-strength-reduction pass doesn't preserve debug information,
for any transformation it makes. Compiling the example below with llvm/clang @
r340912 and options "-O2 -g -fno-inline" for x86_64, using both gdb and lldb,
both the value of "i" and "blah" are reported as being optimised out, after
being rewritten by LSR:

-------->8--------
int
foo(int blah)
{
  int i;
  for (i = blah; i < blah + 10; i++) {
    if (i < 3)
      return 0;
  }
  return 1;
}

int
main()
{
  return foo(3);
}
--------8<--------

Which would be fairly frustrating if one landed in the loop and were unable to
determine either the loop bound or which iteration it was on. (The example is
contrived, but LSR still knackers more complicated loops).

This isn't a bug per se, and the DebugInfo doesn't mislead anyone, it's just a
poor debug experience that will annoy developers. Particularly galling is that
the values of "i" and "blah" remain in registers for the whole loop, but are
still not available to the debugger.


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=38768
[Bug 38768] [meta][DebugInfo] Umbrella bug for poor debug experiences
-- 
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/20180903/ccebb6e0/attachment-0001.html>


More information about the llvm-bugs mailing list