[DebugInfo] Discard invalid DBG_VALUE instructions in LiveDebugVariables
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 6 Mar 2018 08:47:07 +0000 (08:47 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Tue, 6 Mar 2018 08:47:07 +0000 (08:47 +0000)
commitbdf0c001876c5801e107f327fd0f7cee9658d6c5
treeb489654891168f4806cc180f5fb2f0e24f609339
parent2f358738b87455180b528a52738faaa0aecd38bb
[DebugInfo] Discard invalid DBG_VALUE instructions in LiveDebugVariables

Summary:
This is a workaround for pr36417
https://bugs.llvm.org/show_bug.cgi?id=36417

LiveDebugVariables will now verify that the DBG_VALUE instructions
are sane (prior to register allocation) by asking LIS if a virtual
register used in the DBG_VALUE is live (or dead def) in the slot
index before the DBG_VALUE. If it isn't sane the DBG_VALUE is
discarded.

One pass that was identified as introducing non-sane DBG_VALUE
instructtons, when analysing pr36417, was the DAG->DAG Instruction
Selection. It sometimes inserts DBG_VALUE instructions referring to
a virtual register that is defined later in the same basic block.
So it is a use before def kind of problem. The DBG_VALUE is
typically inserted in the beginning of a basic block when this
happens. The problem can be seen in the test case
test/DebugInfo/X86/dbg-value-inlined-parameter.ll

Reviewers: aprantl, rnk, probinson

Reviewed By: aprantl

Subscribers: vsk, davide, alexcrichton, Ka-Ka, eraman, llvm-commits, JDevlieghere

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

llvm-svn: 326769
llvm/lib/CodeGen/LiveDebugVariables.cpp
llvm/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
llvm/test/DebugInfo/X86/live-debug-vars-discard-invalid.mir [new file with mode: 0644]