summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-10-15 19:22:20 +0000
committerVedant Kumar <vsk@apple.com>2018-10-15 19:22:20 +0000
commit15718a61903f4f61956c85ce3ceed5a43d61b006 (patch)
treee6cb87ec988bf9bf937cd0d86735ba417e5e9d88 /llvm/lib/Transforms/Utils/CodeExtractor.cpp
parent795cc9332b771e8f578f5ae14855d4152c72bdec (diff)
downloadbcm5719-llvm-15718a61903f4f61956c85ce3ceed5a43d61b006.tar.gz
bcm5719-llvm-15718a61903f4f61956c85ce3ceed5a43d61b006.zip
[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
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