[PATCH] D48408: [Debugify] Diagnose mis-sized dbg.values

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 17:32:05 PDT 2018


vsk created this revision.
vsk added reviewers: aprantl, gramanas, probinson.

A dbg.value instruction has a value operand as well as an associated
variable. The debugger may not be able to correctly print out the value
of a variable (as specified by the dbg.value) if the dbg.value is mis-
sized.

A dbg.value is mis-sized if the size of its value operand doesn't match
up with the size of its associated variable. With an exception for
integers, these sizes need to be equal in order for the debugger to
print out the right value.

Eventually this check should be moved into the IR verifier. For the
moment, it's useful to include the check in -check-debugify as a means
of catching regressions and finding existing bugs.

Here are some instances of bugs the new check finds in the -O2 pipeline:

CheckFunctionDebugify [Simplify the CFG]: PASS
ERROR: dbg.value operand has size 32, but its variable has size 64:   call void @llvm.dbg.value(metadata float %expf, metadata !12, metadata !DIExpression()), !dbg !15

CheckFunctionDebugify [Loop Load Elimination]: PASS
ERROR: dbg.value operand has size 8, but its variable has size 32:   call void @llvm.dbg.value(metadata i8 %t4, metadata !14, metadata !DIExpression()), !dbg !24

CheckFunctionDebugify [SLP Vectorizer]: PASS
ERROR: dbg.value operand has size 128, but its variable has size 256:   call void @llvm.dbg.value(metadata <4 x i32> %4, metadata !40, metadata !DIExpression()), !dbg !95


https://reviews.llvm.org/D48408

Files:
  test/DebugInfo/debugify-bogus-dbg-value.ll
  tools/opt/Debugify.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48408.152206.patch
Type: text/x-patch
Size: 5683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180621/68eefad7/attachment.bin>


More information about the llvm-commits mailing list