[PATCH] D57696: [DebugInfo] Separate DbgValueInst and DIExpression logic in salvageDebugInfo for reusability.

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 09:27:04 PST 2019


jmorse created this revision.
jmorse added reviewers: aprantl, vsk, bjope.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch refactors the logic for folding/salvaging the operation of an instruction into a DIExpression. The rationale behind this is to allow salvage operations of debug info that is not represented by a dbg.value intrinsic, specifically in D57694 <https://reviews.llvm.org/D57694>. There should be no functional change. (There might also be better ways of achieving D57694 <https://reviews.llvm.org/D57694> without this change, input appreciated).

This is a fairly simple separation of the segment of salvageDebugInfo that gets/sets fields of DbgVariableIntrinsic insts, and the segment that determines a list of opcodes to add to the DIExpression. This builds in the assumption that the Value the salvaged DIExpression operates on is the first operand of the original instruction -- which the original code appears to assume anyway.

There is likely a small performance downside of this, as the original implementation performed the outer (i.e., instruction-type) tests only once then iterated over a collection of debug users, wheras now the outer tests occur for each debug user. While this sucks, it's a legitimate (IMHO, YMMV) trade-off for generality, and will likely be inlined away anyway. I looked at ways of preserving the previous implementation with additional abstractions, but IMHO after two layers of callbacks/lambdas it isn't worth it.

The patch display is a bit ugly in Phab but I don't think I can do much about that. Note that there's a comment on handling GEPs on origina-line 1646 that I've deleted, as it does not appear to be true.

Patch is based on D56788 <https://reviews.llvm.org/D56788>.


Repository:
  rL LLVM

https://reviews.llvm.org/D57696

Files:
  include/llvm/Transforms/Utils/Local.h
  lib/Transforms/Utils/Local.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57696.185070.patch
Type: text/x-patch
Size: 8616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190204/d58e88cd/attachment.bin>


More information about the llvm-commits mailing list