[PATCH] D76146: [DebugInfo] Use DW_OP_LLVM_convert_generic after sign/zero exts

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 11:17:59 PDT 2020


dstenb created this revision.
dstenb added reviewers: aprantl, markus, vsk, StephenTozer.
dstenb added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
dstenb added a parent revision: D76145: [DebugInfo] Introduce a DW_OP_LLVM_convert_generic operation.

This is a follow-up to D76145 <https://reviews.llvm.org/D76145>.

DW_OP_LLVM_convert is used to do sign- and zero extensions in
DIExpressions. When using DWARFv5, that LLVM operation is translated
into DWARFv5's DW_OP_convert operation.

DWARFv5 section 2.5.1.4 specifies the following for arithmetical and
logical operations:

"Operands of an operation with two operands must have the same type,
 either the same base type or the generic type."

So when we have used DW_OP_LLVM_convert in an expression, we need to
make sure that any arithmetical and logical operations operating on that
element have operands of the same type. As we currently don't have a
good interface for detecting what type is on top of the stack, and we
add arithmetical and logical operations, e.g. appending expressions like
{DW_OP_constu 1, DW_OP_plus}, in many places, this patch attempts to
alleviate such cases by introduced a new operation,
DW_OP_LLVM_convert_generic, which converts the top of the stack back to
the generic type.

This operation is appended to the sign/zero extension expression that
DIExpression::getExtOps() produces.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76146

Files:
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/lib/IR/DebugInfoMetadata.cpp
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
  llvm/test/Transforms/EarlyCSE/debug-info-undef.ll
  llvm/test/Transforms/InstCombine/cast-set-preserve-signed-dbg-val.ll
  llvm/test/Transforms/InstCombine/dbg-sign-ext-to-generic.ll
  llvm/test/Transforms/InstCombine/unavailable-debug.ll
  llvm/unittests/Transforms/Utils/LocalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76146.250258.patch
Type: text/x-patch
Size: 10323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200313/6c29f034/attachment.bin>


More information about the llvm-commits mailing list