From e75808cf3d92d14c5659a15d0d17bd21a54fd8cc Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 6 Nov 2008 21:28:20 +0000 Subject: [PATCH] Emit label for llvm.dbg.func.start of the inlined function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58814 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/FastISel.cpp | 11 ++++++++--- test/DebugInfo/2008-11-05-InlinedFuncStart.ll | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 404d613ac88..b45a4fd5369 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -349,9 +349,14 @@ bool FastISel::SelectCall(User *I) { SubprogramDesc *Subprogram = cast(DD); const CompileUnitDesc *CompileUnit = Subprogram->getFile(); unsigned SrcFile = MMI->RecordSource(CompileUnit); - // Record the source line but does create a label. It will be emitted - // at asm emission time. - MMI->RecordSourceLine(Subprogram->getLine(), 0, SrcFile); + // Record the source line but does not create a label for the normal + // function start. It will be emitted at asm emission time. However, + // create a label if this is a beginning of inlined function. + unsigned LabelID = MMI->RecordSourceLine(Subprogram->getLine(), 0, SrcFile); + if (MMI->getSourceLines().size() != 1) { + const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); + BuildMI(MBB, II).addImm(LabelID); + } } return true; } diff --git a/test/DebugInfo/2008-11-05-InlinedFuncStart.ll b/test/DebugInfo/2008-11-05-InlinedFuncStart.ll index 5df872462cc..a35a88ebd6b 100644 --- a/test/DebugInfo/2008-11-05-InlinedFuncStart.ll +++ b/test/DebugInfo/2008-11-05-InlinedFuncStart.ll @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | llc +; RUN: llvm-as < %s | llc -fast %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } -- 2.34.1