Erase constant dbgloc on reuse in PHI node
authorSergey Dmitrouk <sdmitrouk@accesssoftek.com>
Thu, 4 Jun 2015 20:48:40 +0000 (20:48 +0000)
committerSergey Dmitrouk <sdmitrouk@accesssoftek.com>
Thu, 4 Jun 2015 20:48:40 +0000 (20:48 +0000)
commita8dc0ee52092c232b5bf8cde09c24a273225c8b4
treeae8e80ba689f15f111ff01be11273ac6660214fa
parentea3663052887d2b1ffdbb01f2e26101de87f9eee
Erase constant dbgloc on reuse in PHI node

Basic block selection involves checking successor BBs for PHI nodes
that depend on the current BB.  In case such BBs are found, the value
being selected is a constant and such constant already exists in
current BB, it's value is reused.

This might lead to wrong locations in some situations, especially if
same constant value ends up being materialized twice in two different
ways, which discards that sharing and leaves us with wrong debug
location in the successor BB.

In code this involves the following sequence of calls:

 SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks ->
 SelectionDAGBuilder::CopyValueToVirtualRegister ->
 SelectionDAGBuilder::getNonRegisterValue

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239089 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
test/DebugInfo/X86/inlined-indirect-value.ll [new file with mode: 0644]