When GVN removes a redundant load, it should not modify the debug location of the...
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Wed, 7 Dec 2016 12:31:36 +0000 (12:31 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Wed, 7 Dec 2016 12:31:36 +0000 (12:31 +0000)
commitae5780104f1a784f5dffc6058125f6c686248ae9
tree3cbc7bc55dad102484a58dd68c3c892fe40d12aa
parent8893bd95f01538580eac61b65de48ee2a83d0763
When GVN removes a redundant load, it should not modify the debug location of the dominating load.

In the case of a fully redundant load LI dominated by an equivalent load V, GVN
should always preserve the original debug location of V. Otherwise, we risk to
introduce an incorrect stepping.
If V has debug info, then clearly it should not be modified. If V has a null
debugloc, then it is still potentially incorrect to propagate LI's debugloc
because LI may not post-dominate V.

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

llvm-svn: 288903
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/dbg-redundant-load.ll [new file with mode: 0644]