summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/CodeExtractor.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CodeExtractor.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index 0e9e3219033..7b45b1799c4 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -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;
OpenPOWER on IntegriCloud