[PATCH] D46129: [SelectionDAG] Improve selection of DBG_VALUE using a PHI node result
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 26 09:16:05 PDT 2018
bjope created this revision.
Herald added subscribers: JDevlieghere, aprantl.
When building the selection DAG at ISel all PHI nodes are
selected and lowered to Machine Instruction PHI nodes before
we start to create any SDNodes. So there are no SDNodes for
values produced by the PHI nodes.
In the past when selecting a dbg.value intrinsic that uses
the value produced by a PHI node we have been handling such
dbg.value intrinsics as "dangling debug info". I.e. we have
not created a SDDbgValue node directly, because there is
no existing SDNode for the PHI result, instead we deferred
the creationg of a SDDbgValue until we found the first use
of the PHI result.
The old solution had a couple of flaws. The position of the
selected DBG_VALUE instruction would end up quite late in a
basic block, and for example not directly after the PHI node
as in the LLVM IR input. And in case there were no use at all
in the basic block the dbg.value could be dropped completely.
This patch introduces a new VREG kind of SDDbgValue nodes.
It is similar to a SDNODE kind of node, but it refers directly
to a virtual register and not a SDNode. When we do selection
for a dbg.value that is using the result of a PHI node we
can do a lookup of the virtual register directly (as it already
is determined for the PHI node) and create a SDDbgValue node
immediately instead of delaying the selection until we find a
use.
Fixes PR37234 (https://bugs.llvm.org/show_bug.cgi?id=37234)
Repository:
rL LLVM
https://reviews.llvm.org/D46129
Files:
include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/InstrEmitter.cpp
lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
test/DebugInfo/COFF/pieces.ll
test/DebugInfo/X86/sdag-dbgvalue-phi-use-1.ll
test/DebugInfo/X86/sdag-dbgvalue-phi-use-2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46129.144135.patch
Type: text/x-patch
Size: 25507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180426/3ebe25ac/attachment-0001.bin>
More information about the llvm-commits
mailing list