Fix a debug location handling bug in GVN.
authorAdrian Prantl <aprantl@apple.com>
Thu, 20 Aug 2015 18:23:56 +0000 (18:23 +0000)
committerAdrian Prantl <aprantl@apple.com>
Thu, 20 Aug 2015 18:23:56 +0000 (18:23 +0000)
commit0f8344c168e59002843f4b124f4146f783d31cd7
tree2cc0077ae71ed9ae96d129b9c40f154b8a282fa8
parent027e2d7d09f1ca816389f7a32095d7113ec4dede
Fix a debug location handling bug in GVN.
Caught by the famous "DebugLoc describes the currect SubProgram" assertion.

When GVN is removing a nonlocal load it updates the debug location of the
SSA value it replaced the load with with the one of the load. In the
testcase this actually overwrites a valid debug location with an empty one.

In reality GVN has to make an arbitrary choice between two equally valid
debug locations. This patch changes to behavior to only update the
location if the value doesn't already have a debug location.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245588 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/GVN.cpp
test/DebugInfo/gvn.ll [new file with mode: 0644]