[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 17:27:26 PDT 2018


vsk added inline comments.


================
Comment at: test/Transforms/InstCombine/cast-set-preserve-signed-dbg-val.ll:17
+  ; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[and]], metadata [[C:![0-9]+]],
+  ; CHECK-SAME:    metadata !DIExpression(DW_OP_constu, 15, DW_OP_shr, DW_OP_constu, 4294967295, DW_OP_mul, DW_OP_stack_value, DW_OP_LLVM_fragment, 16, 16))
+  ;
----------------
aprantl wrote:
> vsk wrote:
> > aprantl wrote:
> > > aprantl wrote:
> > > > wouldn't `DW_OP_lit0 DW_OP_not` be shorter than `DW_OP_constu 0xfffffff` ?
> > > To keep the IR simple we could also recognize and normalize this sequence in DwarfExpression.cpp
> > Sounds good, thanks! I'll save the normalizing change for later.
> While you're at it:
> 
> DW_OP_constu, 15 could be shortened to DW_OP_lit15 :-)
> 
> It should also be more efficient to join the two fragments `<lower> <upper> DW_OP_lit16 DW_OP_shl DW_OP_or`
> That saves two DW_OP_LLVM_fragment expressions and one dbg.value.
Nice, I've made a note of the DW_OP_litX (X < 32) normalization :).

I don't see how to use a single dbg.value to describe a sign-extended variable. You need to refer to the value operand of the dbg.value twice: once for the initial SHR, and again at the end for the OR. Are you suggesting making this work using DW_OP_dup? So, for this example:

`DW_OP_dup /* Duplicate the 16-bit and */, lit15, SHR, lit0, NOT, MUL /* Calculate the high bits */, OR /* Combine the high bits with the duplicated low bits */`?


https://reviews.llvm.org/D48676





More information about the llvm-commits mailing list