[GVN] Set proper debug locations for some instructions created by GVN.
authorAlexey Samsonov <vonosmas@gmail.com>
Wed, 10 Jun 2015 17:37:38 +0000 (17:37 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Wed, 10 Jun 2015 17:37:38 +0000 (17:37 +0000)
commit881c8e0c9ac3eb8d9d20d34b2354ac413f8146b4
tree58a2a142a9e81f57fed104ed5b513d5381ae1b2c
parent708de57fee131ab34a5def889bca7783ab7fd42b
[GVN] Set proper debug locations for some instructions created by GVN.

Determining proper debug locations for instructions created in
PHITransAddr is tricky. We use a simple approach here and simply copy
debug locations from instructions computing load address to
"corresponding" instructions re-creating the address computation
in predecessor basic blocks.

This may not always be correct, given all the rearrangement and
simplification going on, and debug locations may jump around a lot,
as the basic blocks we copy locations between may be very far from
each other.

Still, this would work good in most simple cases (e.g. when chain
of address computing instruction is short, or our mapping turns out
to be 1-to-1), and we desire to have *some* reasonable debug locations
associated with newly inserted instructions.

See http://reviews.llvm.org/D10351 review thread for more details.

Test Plan: regression test suite

Reviewers: spatel, dblaikie

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D10351

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239479 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/PHITransAddr.cpp
lib/Transforms/Scalar/GVN.cpp
test/Transforms/GVN/phi-translate.ll