summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-09-11 17:55:58 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-09-11 17:55:58 +0000
commit5b7e21a6b7e35cd8fba49efe7462e610d78c9314 (patch)
tree6e5609b671e6c8097037b1d16d5d52b07c4cde5e /llvm/lib/Transforms
parentf446facab0e38c7496ac581f31335e60ec896cb9 (diff)
downloadbcm5719-llvm-5b7e21a6b7e35cd8fba49efe7462e610d78c9314.tar.gz
bcm5719-llvm-5b7e21a6b7e35cd8fba49efe7462e610d78c9314.zip
[CallSiteSplitting] Add debug location to created PHI nodes.
There are 2 cases when we create PHI nodes: * For the result of the call that was duplicated in the split blocks. Those PHI nodes should have the debug location of the call. * For values produced before the call. Those instructions need to be duplicated in the split blocks and the PHI nodes should have the debug locations of those instructions. Fixes PR37962. Reviewers: junbuml, gbedwell, vsk Reviewed By: junbuml Tags: #debug-info Differential Revision: https://reviews.llvm.org/D51919 llvm-svn: 341970
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
index 5ebfbf8a879..54385155cd2 100644
--- a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
+++ b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
@@ -312,8 +312,10 @@ static void splitCallSite(
// `musttail` calls must be followed by optional `bitcast`, and `ret`. The
// split blocks will be terminated right after that so there're no users for
// this phi in a `TailBB`.
- if (!IsMustTailCall && !Instr->use_empty())
+ if (!IsMustTailCall && !Instr->use_empty()) {
CallPN = PHINode::Create(Instr->getType(), Preds.size(), "phi.call");
+ CallPN->setDebugLoc(Instr->getDebugLoc());
+ }
LLVM_DEBUG(dbgs() << "split call-site : " << *Instr << " into \n");
@@ -394,6 +396,7 @@ static void splitCallSite(
if (isa<PHINode>(CurrentI))
continue;
PHINode *NewPN = PHINode::Create(CurrentI->getType(), Preds.size());
+ NewPN->setDebugLoc(CurrentI->getDebugLoc());
for (auto &Mapping : ValueToValueMaps)
NewPN->addIncoming(Mapping[CurrentI],
cast<Instruction>(Mapping[CurrentI])->getParent());
OpenPOWER on IntegriCloud