summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt/Debugify.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-02-13 18:15:27 +0000
committerVedant Kumar <vsk@apple.com>2018-02-13 18:15:27 +0000
commit1627632c488e1e7ffb62c6d29e1b78285f7e0bac (patch)
tree218fab7aa9397cc6b028b564c8609f71e7e6770b /llvm/tools/opt/Debugify.cpp
parent35fc103e1e8d1f069d7a5ada7131466c3402c265 (diff)
downloadbcm5719-llvm-1627632c488e1e7ffb62c6d29e1b78285f7e0bac.tar.gz
bcm5719-llvm-1627632c488e1e7ffb62c6d29e1b78285f7e0bac.zip
[Debugify] Avoid verifier failure on non-definition subprograms
If a function doesn't have an exact definition, don't apply debugify metadata as it triggers a DIVerifier failure. The issue is that it's invalid to have DILocations inside a DISubprogram which isn't a definition ("scope points into the type hierarchy!"). llvm-svn: 325036
Diffstat (limited to 'llvm/tools/opt/Debugify.cpp')
-rw-r--r--llvm/tools/opt/Debugify.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/tools/opt/Debugify.cpp b/llvm/tools/opt/Debugify.cpp
index ec546e56d44..931b8009a67 100644
--- a/llvm/tools/opt/Debugify.cpp
+++ b/llvm/tools/opt/Debugify.cpp
@@ -66,14 +66,14 @@ bool applyDebugifyMetadata(Module &M) {
// Visit each instruction.
for (Function &F : M) {
- if (F.isDeclaration())
+ if (F.isDeclaration() || !F.hasExactDefinition())
continue;
auto SPType = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
bool IsLocalToUnit = F.hasPrivateLinkage() || F.hasInternalLinkage();
auto SP =
DIB.createFunction(CU, F.getName(), F.getName(), File, NextLine, SPType,
- IsLocalToUnit, F.hasExactDefinition(), NextLine,
+ IsLocalToUnit, /*isDefinition=*/true, NextLine,
DINode::FlagZero, /*isOptimized=*/true);
F.setSubprogram(SP);
for (BasicBlock &BB : F) {
OpenPOWER on IntegriCloud