HomePhabricator

[Debugify] Diagnose mis-sized dbg.values

Authored by vsk on Jun 26 2018, 3:46 PM.

Description

[Debugify] Diagnose mis-sized dbg.values

Report an error in -check-debugify when the size of a dbg.value operand
doesn't match up with the size of the variable it describes.

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
(all in InstCombine):

  1. A float is used where a double is expected:

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

  1. An i8 is used where an i32 is expected:

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

  1. A <4 x i32> is used where something twice as large is expected

(perhaps a <4 x i64>, I haven't double-checked):

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

Differential Revision: https://reviews.llvm.org/D48408

llvm-svn: 335682

Details

Committed
vskJun 26 2018, 3:46 PM
Differential Revision
D48408: [Debugify] Diagnose mis-sized dbg.values
Parents
rG289a7d4c7da8: Revert "[asan] Instrument comdat globals on COFF targets"
Branches
Unknown
Tags
Unknown