diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-06-20 21:08:52 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-06-20 21:08:52 +0000 |
commit | 25422dcccbf4b4030c20ab3900a5a61c38f744e0 (patch) | |
tree | 89adf763984e2180b7aa87aff294673f6baeedc6 /llvm/lib/CodeGen/AsmPrinter | |
parent | 36bc095a2ea9bcdd928665f2a10bd72bff219a62 (diff) | |
download | bcm5719-llvm-25422dcccbf4b4030c20ab3900a5a61c38f744e0.tar.gz bcm5719-llvm-25422dcccbf4b4030c20ab3900a5a61c38f744e0.zip |
Fix a crash in DwarfDebug::validThroughout.
The instruction it falls over on is an IMPLICT_DEF that also happens
to be the only instruction in its lexical scope. That LexicalScope has
never been created because its range is empty. This patch skips over
all meta-instructions instead of just DBG_VALUEs.
Thanks to David Blaikie for providing a testcase!
llvm-svn: 305853
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index d392e372863..f1b4d9f20ca 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1000,12 +1000,14 @@ static bool validThroughout(LexicalScopes &LScopes, if (Pred->getFlag(MachineInstr::FrameSetup)) break; auto PredDL = Pred->getDebugLoc(); - if (!PredDL || Pred->isDebugValue()) + if (!PredDL || Pred->isMetaInstruction()) continue; // Check whether the instruction preceding the DBG_VALUE is in the same // (sub)scope as the DBG_VALUE. - if (DL->getScope() == PredDL->getScope() || - LScope->dominates(LScopes.findLexicalScope(PredDL))) + if (DL->getScope() == PredDL->getScope()) + return false; + auto *PredScope = LScopes.findLexicalScope(PredDL); + if (!PredScope || LScope->dominates(PredScope)) return false; } |