summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorMikael Holmen <mikael.holmen@ericsson.com>2017-08-24 09:05:00 +0000
committerMikael Holmen <mikael.holmen@ericsson.com>2017-08-24 09:05:00 +0000
commit7a99e33b8eef4b6656f6dca7b83b1b4837ff732a (patch)
treedadbe30b91d836d8307bcf653f07c417c881ffaf /llvm/lib/Transforms/Scalar
parentc602af9a5e82e8ea9070f38d361ed35cc799650d (diff)
downloadbcm5719-llvm-7a99e33b8eef4b6656f6dca7b83b1b4837ff732a.tar.gz
bcm5719-llvm-7a99e33b8eef4b6656f6dca7b83b1b4837ff732a.zip
[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 llvm-svn: 311642
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index e0ef8cfe46b..58832447e1e 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -2137,7 +2137,8 @@ void ReassociatePass::ReassociateExpression(BinaryOperator *I) {
DEBUG(dbgs() << "Reassoc to scalar: " << *V << '\n');
I->replaceAllUsesWith(V);
if (Instruction *VI = dyn_cast<Instruction>(V))
- VI->setDebugLoc(I->getDebugLoc());
+ if (I->getDebugLoc())
+ VI->setDebugLoc(I->getDebugLoc());
RedoInsts.insert(I);
++NumAnnihil;
return;
OpenPOWER on IntegriCloud