[Assignment Tracking][SelectionDAG] Fix dbg.declare location nullptr deref
authorOCHyams <orlando.hyams@sony.com>
Tue, 18 Apr 2023 07:05:12 +0000 (08:05 +0100)
committerOCHyams <orlando.hyams@sony.com>
Tue, 18 Apr 2023 07:43:54 +0000 (08:43 +0100)
commit2ccbd19473a1e35b88dc4e6c9f0d0b0e5801804d
tree62363719cb0587a51e5ca5db79ba28cfeb23a1e0
parent912fedfbe5b9a2120c2a48a142abaff3bdc7a971
[Assignment Tracking][SelectionDAG] Fix dbg.declare location nullptr deref

Debug intrinsics sometimes end up with empty metadata location operands. The
debug intrinsic interfaces return nullptr when retrieving location operand in
this case.

When assignment tracking is not enabled a dbg.declare with a nullptr location
operand is skipped. Do the same when assignment tracking is enabled (a nullptr
address component of a dbg.assign is already handled correctly.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D148203
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/test/DebugInfo/assignment-tracking/X86/single-memory-location.ll