summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2013-04-30 17:08:16 +0000
committerAdrian Prantl <aprantl@apple.com>2013-04-30 17:08:16 +0000
commit0941638a1bd7675910f3a05b67d4c006bd9fbf09 (patch)
tree127c9046f57b34afc13e6b8715e13ddb33b28df4 /llvm/lib/Transforms/Utils/InlineFunction.cpp
parentb1835b79470c30e76dcb17c054f160591fa7a5d6 (diff)
downloadbcm5719-llvm-0941638a1bd7675910f3a05b67d4c006bd9fbf09.tar.gz
bcm5719-llvm-0941638a1bd7675910f3a05b67d4c006bd9fbf09.zip
Set debug locations for branch instructions created during inlining, even
the inlined function has multiple returns. rdar://problem/12415623 llvm-svn: 180793
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index e9f0e28ad65..ae9300a40ad 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -853,11 +853,19 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
// Add a branch to the merge points and remove return instructions.
+ ReturnInst *RI;
for (unsigned i = 0, e = Returns.size(); i != e; ++i) {
- ReturnInst *RI = Returns[i];
- BranchInst::Create(AfterCallBB, RI);
+ RI = Returns[i];
+ BranchInst* BI = BranchInst::Create(AfterCallBB, RI);
+ BI->setDebugLoc(RI->getDebugLoc());
RI->eraseFromParent();
}
+ // We need to set the debug location to *somewhere* inside the
+ // inlined function. The line number may be nonsentical, but the
+ // instruction will at least be associated with the right
+ // function.
+ if (CreatedBranchToNormalDest)
+ CreatedBranchToNormalDest->setDebugLoc(RI->getDebugLoc());
} else if (!Returns.empty()) {
// Otherwise, if there is exactly one return value, just replace anything
// using the return value of the call with the computed value.
OpenPOWER on IntegriCloud