[llvm-bugs] [Bug 40645] New: [DebugInfo at O2] EarlyCSE accidentally deletes unused arguments
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 7 06:43:50 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40645
Bug ID: 40645
Summary: [DebugInfo at O2] EarlyCSE accidentally deletes unused
arguments
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: CONFIRMED
Keywords: wrong-debug
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: jeremy.morse.llvm at gmail.com
CC: chackz0x12 at gmail.com, dblaikie 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
Using LLVM/clang r352480 (10 days old) and the command line "-O2 -g -c" on the
code below, the 'nose' argument does not receive a location in the output
binary. However if one deletes the dead assignments of "shoe" and "boot", then
it does!
--------8<--------
struct chin {
int a;
int b;
};
int
foo(struct chin nose, int more)
{
int shoe = nose.a;
int boot = nose.b;
more += 1;
return more;
}
-------->8--------
I suspect the location appears when "nose" is never read because SROA doesn't
attempt to split it into fragments, instead issuing a 64-bit dbg.value for the
'nose' variable. But if there are reads in the program, two 32-bit dbg.values
and associated reading instructions are produced, then get lost. The culprit
appears to be EarlyCSE, which sets the operands of the 32-bit dbg.values to
undef:
call void @llvm.dbg.value(metadata i32 %3, metadata !16, metadata
!DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !20
Becomes
call void @llvm.dbg.value(metadata i32 undef, metadata !16, metadata
!DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !20
If one replaces the addition to 'more' with either shoe or boot, then the
corresponding field of 'nose' appears in the outputs debug location
information, however not the other field.
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/20190207/8870b3c7/attachment-0001.html>
More information about the llvm-bugs
mailing list