[CodeExtractor] Erase debug intrinsics in outlined thunks (fix PR22900)
Variable updates within the outlined function are invisible to debuggers. This could be improved by defining a DISubprogram for the new function. For the moment, simply erase the debug intrinsics instead. This fixes verifier failures about function-local metadata being used in the wrong function, seen while testing the hot/cold splitting pass. rdar://45142482 Differential Revision: https://reviews.llvm.org/D53267 llvm-svn: 344545
This commit is contained in:
@@ -1286,6 +1286,19 @@ Function *CodeExtractor::extractCodeRegion() {
|
||||
}
|
||||
}
|
||||
|
||||
// Erase debug info intrinsics. Variable updates within the new function are
|
||||
// invisible to debuggers. This could be improved by defining a DISubprogram
|
||||
// for the new function.
|
||||
for (BasicBlock &BB : *newFunction) {
|
||||
auto BlockIt = BB.begin();
|
||||
while (BlockIt != BB.end()) {
|
||||
Instruction *Inst = &*BlockIt;
|
||||
++BlockIt;
|
||||
if (isa<DbgInfoIntrinsic>(Inst))
|
||||
Inst->eraseFromParent();
|
||||
}
|
||||
}
|
||||
|
||||
LLVM_DEBUG(if (verifyFunction(*newFunction))
|
||||
report_fatal_error("verifyFunction failed!"));
|
||||
return newFunction;
|
||||
|
||||
Reference in New Issue
Block a user