[llvm-bugs] [Bug 39018] New: [DebugInfo at O2][Dexter] Vectorized loop presents constant-valued iterator to debugger
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 20 08:08:25 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39018
Bug ID: 39018
Summary: [DebugInfo at O2][Dexter] Vectorized loop presents
constant-valued iterator to debugger
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 am.sony.com
Blocks: 38768
The vectorized loop below has a constant valued iterator according to debug
info in optimised programs. Using clang/llvm r342527, compiling "-O2 -g
-fno-inline" targeting x86_64, and running under gdb or lldb, printing 'i' on
any iteration of the first loop will yield the value zero. Obviously this is
misleading to the developer.
Running dwarfdump shows that there's just one debug location for 'i', where
it's assigned the constant value of zero. My feeling is that the vectorizer
discards all debug data in the loop, leaving only one dbg.value call in the
program (the constant initializer) and no indication of what the liveness of
that value is. [This class of bug is likely to be a theme].
I imagine putting dbg.value(undef, ...) in the vectorized loop might fix this,
however I'm not really familiar with the vectorizer at all.
The problem replicates if you add -fno-unroll-loops to the command line, and
gives you assembly you have a chance of understanding.
-------->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; 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/317044d5/attachment.html>
More information about the llvm-bugs
mailing list