OSDN Git Service

[Reassociate] Do not drop debug location if replacement is missing
authorMikael Holmen <mikael.holmen@ericsson.com>
Thu, 24 Aug 2017 09:05:00 +0000 (09:05 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Thu, 24 Aug 2017 09:05:00 +0000 (09:05 +0000)
commit6dbfbe1563d4440f53d34b62990546d2f99aa513
tree41973a80494395ba2ddd08dec7e9ff1d655e9644
parent89feab7412dbe0b505fbcc5d6feaef239b1de238
[Reassociate] Do not drop debug location if replacement is missing

Summary:
When reassociating an expression, do not drop the instruction's
original debug location in case the replacement location is
missing.

The debug location must at least not be dropped for inlinable
callsites of debug-info-bearing functions in debug-info-bearing
functions. Failing to do so would result in an "inlinable function "
"call in a function with debug info must have a !dbg location"
error in the verifier.

As preserving the original debug location is not expected
to result in overly jumpy debug line information, it is
preserved for all other cases too.

This fixes PR34231:
https://bugs.llvm.org/show_bug.cgi?id=34231

Original patch by David Stenberg

Reviewers: davide, craig.topper, mcrosier, dblaikie, aprantl

Reviewed By: davide, aprantl

Subscribers: aprantl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311642 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/keep-debug-loc.ll [new file with mode: 0644]