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

            Bug ID: 39019
           Summary: [DebugInfo@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: unassignedb...@nondot.org
          Reporter: jeremy.morse.l...@gmail.com
                CC: chackz0...@gmail.com, greg.bedw...@sony.com,
                    international.phan...@gmail.com,
                    llvm-bugs@lists.llvm.org,
                    paul_robin...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to