[DebugInfo] Don't drop dbg.value's of nullptr
authorJeremy Morse <jeremy.morse.llvm@gmail.com>
Mon, 10 Dec 2018 12:04:08 +0000 (12:04 +0000)
committerJeremy Morse <jeremy.morse.llvm@gmail.com>
Mon, 10 Dec 2018 12:04:08 +0000 (12:04 +0000)
commita06b163d5cee8114cd34c4565bbf1d5f28554684
tree59b3d72d3e717c13fabdfd6bb2af4dece522ff5a
parent1bf1a156d673d5d48ef2ca41cba642c5ed11d683
[DebugInfo] Don't drop dbg.value's of nullptr

Currently, dbg.value's of "nullptr" are dropped when entering a SelectionDAG --
apparently just because of an oversight when recognising Values that are
constant (see PR39787). This patch adds ConstantPointerNull to the list of
constants that can be turned into DBG_VALUEs.

The matter of what bit-value a null pointer constant in LLVM has was raised
in this mailing list thread:

  http://lists.llvm.org/pipermail/llvm-dev/2018-December/128234.html

Where it transpires LLVM relies on (IR) null pointers being zero valued,
thus I've baked this assumption into the patch.

Differential Revision: https://reviews.llvm.org/D55227

llvm-svn: 348753
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/DebugInfo/X86/sdag-dangling-dbgvalue.ll