From 517576d6f96a0acde9bab79553d89f4ceba20cf6 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 15 Apr 2009 00:17:06 +0000 Subject: 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 --- lib/Transforms/Utils/CloneFunction.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/Transforms/Utils/CloneFunction.cpp') 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 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(II)) { - DbgFnStart = DFSI->getSubprogram(); - continue; + if (DbgFnStart == NULL) { + DISubprogram SP(cast(DFSI->getSubprogram())); + if (SP.describes(BB->getParent())) + DbgFnStart = DFSI->getSubprogram(); + } } if (const DbgRegionEndInst *DREIS = dyn_cast(II)) { if (DREIS->getContext() == DbgFnStart) -- cgit v1.2.3-18-g5258