[PATCH] D48676: [Local] Teach insertReplacementDbgValues basic integer/pointer conversions

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 27 15:00:13 PDT 2018


vsk created this revision.
vsk added reviewers: probinson, aprantl, bjope, rnk.
Herald added a subscriber: JDevlieghere.

The insertReplacementDbgValues utility helps optimization passes
preserve debug info when replacing a to-be-DCE'd value with a new value.

This patch simplifies the API by moving the responsibiliy for rewriting
dbg.value DIExpressions from individual passes into common utility code.
This should make the API easier to adopt, and allows generically useful
improvements to be made to the expression rewriting logic.

Along with the API change, this patch teaches insertReplacementDbgValues
how to create DIExpressions for basic integer and pointer conversions:

- The no-op conversion. Applies when the values have the same width, or are bit-for-bit compatible pointer representations.

- Truncation. Applies when the new value is wider than the old one.

- Zero/sign extension. Applies when the new value is narrower than the old one.

Testing:

- check-llvm, check-clang, a stage2 `-g -O3` build of clang, and added regression tests.

- This resolves a number of mis-sized dbg.value diagnostics from Debugify.


https://reviews.llvm.org/D48676

Files:
  include/llvm/IR/DebugInfoMetadata.h
  include/llvm/Transforms/Utils/Local.h
  lib/IR/DebugInfoMetadata.cpp
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  lib/Transforms/Utils/Local.cpp
  test/Transforms/InstCombine/cast-set-preserve-signed-dbg-val.ll
  test/Transforms/InstCombine/dce-iterate.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48676.153187.patch
Type: text/x-patch
Size: 16120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180627/ec9f7ca2/attachment.bin>


More information about the llvm-commits mailing list