summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-04-15 00:17:06 +0000
committerDevang Patel <dpatel@apple.com>2009-04-15 00:17:06 +0000
commit517576d6f96a0acde9bab79553d89f4ceba20cf6 (patch)
treeab5c846b6eaa3fed369ecdbf96b01335d5d8e3e0 /lib/Transforms/Utils/CloneFunction.cpp
parentd25bff6d528e86683f7c3aed1b630776c33a3c71 (diff)
downloadllvm-517576d6f96a0acde9bab79553d89f4ceba20cf6.tar.gz
llvm-517576d6f96a0acde9bab79553d89f4ceba20cf6.tar.bz2
llvm-517576d6f96a0acde9bab79553d89f4ceba20cf6.tar.xz
While inlining, clone llvm.dbg.func.start intrinsic and adjust
llvm.dbg.region.end instrinsic. This nested llvm.dbg.func.start/llvm.dbg.region.end pair now enables DW_TAG_inlined_subroutine support in code generator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index d7b4bd3fd6..d0fdefa3f6 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -24,6 +24,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include "llvm/Analysis/ConstantFolding.h"
+#include "llvm/Analysis/DebugInfo.h"
#include "llvm/ADT/SmallVector.h"
#include <map>
using namespace llvm;
@@ -233,10 +234,13 @@ void PruningFunctionCloner::CloneBlock(const BasicBlock *BB,
continue;
}
- // Do not clone llvm.dbg.func.start and corresponding llvm.dbg.region.end.
+ // Do not clone llvm.dbg.region.end. It will be adjusted by the inliner.
if (const DbgFuncStartInst *DFSI = dyn_cast<DbgFuncStartInst>(II)) {
- DbgFnStart = DFSI->getSubprogram();
- continue;
+ if (DbgFnStart == NULL) {
+ DISubprogram SP(cast<GlobalVariable>(DFSI->getSubprogram()));
+ if (SP.describes(BB->getParent()))
+ DbgFnStart = DFSI->getSubprogram();
+ }
}
if (const DbgRegionEndInst *DREIS = dyn_cast<DbgRegionEndInst>(II)) {
if (DREIS->getContext() == DbgFnStart)