[llvm-bugs] [Bug 39019] New: [DebugInfo at O2][Dexter] Return value unprintable in func with vectorized loop

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 20 08:43:24 PDT 2018


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

            Bug ID: 39019
           Summary: [DebugInfo at O2][Dexter] Return value unprintable in
                    func with vectorized loop
           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

The vectorized-and-reduced summation below in variable 'sum' is reported as
optimized out on the return line, according to debug info. Given the value is
available in $rax we can almost certainly do better. My test setup is using
clang/llvm r342527, compiling "-O2 -g -fno-inline" targeting x86_64, and
running under gdb or lldb.

If you change BUFSZ to be 193 then the vectorized loop gets a scalar tail,
which contains the original body with dbg.value's, and the 'sum' variable is
printable on the return line.

(This is the same code as in bug 39018, but a different issue).

-------->8--------
#include <string.h>

#define BUFSZ 192

int
main()
{
  int foo[BUFSZ];
  int bar[BUFSZ];

  memset(foo, 0, sizeof(foo));
  memset(bar, 1, sizeof(bar));

  for (int i = 0; i < BUFSZ; i++)
    foo[i] += bar[i];

  unsigned int sum = 0;
  for (int j = 0; j < BUFSZ; j++)
    sum += foo[j];

  return sum;
}
--------8<--------


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/20180920/05c8df6d/attachment-0001.html>


More information about the llvm-bugs mailing list