[PATCH] D46384: Reapply "[SelectionDAG] Selection of DBG_VALUE using a PHI node result (pt 2)"

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 3 04:46:45 PDT 2018


bjope created this revision.
bjope added reviewers: vsk, aprantl, mstorsjo.

This reverts SVN r331441, together with a fix in
DIExpression::createFragmentExpression to allow truncation of the
input size in case there is an existing fragment that is smaller
than the offset+size given as input.

This should solve the problem seen in PR37321, which was the
reason for the revert of r331337.

The situation in PR37321 is that we have a PHI node like this

  %u.sroa = phi i80 [ %u.sroa.x, %if.x ],
                    [ %u.sroa.y, %if.y ],
                    [ %u.sroa.z, %if.z ]

and a dbg.value like this

  call void @llvm.dbg.value(metadata i80 %u.sroa,
                            metadata !13,
                            metadata !DIExpression(DW_OP_LLVM_fragment, 0, 80))

The phi node is splitted into three 32-bit PHI nodes

  %30:gr32 = PHI %11:gr32, %bb.4, %14:gr32, %bb.5, %27:gr32, %bb.8
  %31:gr32 = PHI %12:gr32, %bb.4, %15:gr32, %bb.5, %28:gr32, %bb.8
  %32:gr32 = PHI %13:gr32, %bb.4, %16:gr32, %bb.5, %29:gr32, %bb.8

but since the original value only is 80 bits we need to adjust the size
of the last fragment expression, and with this patch we get

  DBG_VALUE debug-use %30:gr32, debug-use $noreg, !"u", !DIExpression(DW_OP_LLVM_fragment, 0, 32)
  DBG_VALUE debug-use %31:gr32, debug-use $noreg, !"u", !DIExpression(DW_OP_LLVM_fragment, 32, 32)
  DBG_VALUE debug-use %32:gr32, debug-use $noreg, !"u", !DIExpression(DW_OP_LLVM_fragment, 64, 16)


Repository:
  rL LLVM

https://reviews.llvm.org/D46384

Files:
  include/llvm/IR/DebugInfoMetadata.h
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  lib/IR/DebugInfoMetadata.cpp
  test/DebugInfo/X86/sdag-dbgvalue-phi-use-3.ll
  test/DebugInfo/X86/sdag-dbgvalue-phi-use-4.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46384.145003.patch
Type: text/x-patch
Size: 19624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180503/45777545/attachment.bin>


More information about the llvm-commits mailing list