summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2016-12-07 12:31:36 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2016-12-07 12:31:36 +0000
commitae5780104f1a784f5dffc6058125f6c686248ae9 (patch)
tree3cbc7bc55dad102484a58dd68c3c892fe40d12aa /llvm/lib/Transforms/Scalar
parent8893bd95f01538580eac61b65de48ee2a83d0763 (diff)
downloadbcm5719-llvm-ae5780104f1a784f5dffc6058125f6c686248ae9.tar.gz
bcm5719-llvm-ae5780104f1a784f5dffc6058125f6c686248ae9.zip
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
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 81f273ff318..9485bfd7c29 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1700,7 +1700,10 @@ bool GVN::processNonLocalLoad(LoadInst *LI) {
if (isa<PHINode>(V))
V->takeName(LI);
if (Instruction *I = dyn_cast<Instruction>(V))
- if (LI->getDebugLoc())
+ // If instruction I has debug info, then we should not update it.
+ // Also, if I has a null DebugLoc, then it is still potentially incorrect
+ // to propagate LI's DebugLoc because LI may not post-dominate I.
+ if (LI->getDebugLoc() && ValuesPerBlock.size() != 1)
I->setDebugLoc(LI->getDebugLoc());
if (V->getType()->getScalarType()->isPointerTy())
MD->invalidateCachedPointerInfo(V);
OpenPOWER on IntegriCloud