summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorPaul Robinson <paul_robinson@playstation.sony.com>2014-10-21 01:00:55 +0000
committerPaul Robinson <paul_robinson@playstation.sony.com>2014-10-21 01:00:55 +0000
commitf60e0a160fc8db67461bcb930924f60a7dccb9be (patch)
tree8a3cba542a276205af4b9122e9b131224683b4be /llvm/lib/Transforms
parentdc6224e0a3ce2b097f0a631de9ae1960f175dfe6 (diff)
downloadbcm5719-llvm-f60e0a160fc8db67461bcb930924f60a7dccb9be.tar.gz
bcm5719-llvm-f60e0a160fc8db67461bcb930924f60a7dccb9be.zip
Do not attribute static allocas to the call site's DebugLoc.
When functions are inlined, instructions without debug information are attributed to the call site's DebugLoc. After inlining, inlined static allocas are moved to the caller's entry block, adjacent to the caller's original static alloca instructions. By retaining the call site's DebugLoc, these instructions could cause instructions that were subsequently inserted at the entry block to pick up the same DebugLoc. Patch by Wolfgang Pieb! llvm-svn: 220255
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index ca33e338eda..1b2e2089415 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -856,6 +856,12 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
// originates from the call location. This is important for
// ((__always_inline__, __nodebug__)) functions which must use caller
// location for all instructions in their function body.
+
+ // Don't update static allocas, as they may get moved later.
+ if (auto *AI = dyn_cast<AllocaInst>(BI))
+ if (isa<Constant>(AI->getArraySize()))
+ continue;
+
BI->setDebugLoc(TheCallDL);
} else {
BI->setDebugLoc(updateInlinedAtInfo(DL, TheCallDL, BI->getContext()));
OpenPOWER on IntegriCloud