diff options
Diffstat (limited to 'llvm/tools/opt/Debugify.cpp')
| -rw-r--r-- | llvm/tools/opt/Debugify.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/tools/opt/Debugify.cpp b/llvm/tools/opt/Debugify.cpp index ba8927fd19c..4a7da2eecd3 100644 --- a/llvm/tools/opt/Debugify.cpp +++ b/llvm/tools/opt/Debugify.cpp @@ -87,6 +87,10 @@ bool applyDebugifyMetadata(Module &M, for (Instruction &I : BB) I.setDebugLoc(DILocation::get(Ctx, NextLine++, 1, SP)); + // Inserting debug values into EH pads can break IR invariants. + if (BB.isEHPad()) + continue; + // Attach debug values. for (Instruction &I : BB) { // Skip void-valued instructions. @@ -97,6 +101,11 @@ bool applyDebugifyMetadata(Module &M, if (isa<TerminatorInst>(&I) || isa<DbgValueInst>(&I)) break; + // Don't insert instructions after a musttail call. + if (auto *Call = dyn_cast<CallInst>(&I)) + if (Call->isMustTailCall()) + break; + std::string Name = utostr(NextVar++); const DILocation *Loc = I.getDebugLoc().get(); auto LocalVar = DIB.createAutoVariable(SP, Name, File, Loc->getLine(), |

