[llvm-commits] [llvm] r107228 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll
Devang Patel
dpatel at apple.com
Tue Jun 29 17:11:08 PDT 2010
Author: dpatel
Date: Tue Jun 29 19:11:08 2010
New Revision: 107228
URL: http://llvm.org/viewvc/llvm-project?rev=107228&view=rev
Log:
Add variables into a scope before constructing scope DIE otherwise variables won't be included DIE tree.
Added:
llvm/trunk/test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=107228&r1=107227&r2=107228&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Jun 29 19:11:08 2010
@@ -2746,7 +2746,6 @@
// Construct abstract scopes.
for (SmallVector<DbgScope *, 4>::iterator AI = AbstractScopesList.begin(),
AE = AbstractScopesList.end(); AI != AE; ++AI) {
- constructScopeDIE(*AI);
DISubprogram SP((*AI)->getScopeNode());
if (SP.Verify()) {
// Collect info for variables that were optimized out.
@@ -2761,12 +2760,13 @@
DIVariable DV(cast_or_null<MDNode>(NMD->getOperand(i)));
if (!DV || !ProcessedVars.insert(DV))
continue;
- DbgScope *Scope = DbgScopeMap.lookup(DV.getContext());
+ DbgScope *Scope = AbstractScopes.lookup(DV.getContext());
if (Scope)
Scope->addVariable(new DbgVariable(DV));
}
}
}
+ constructScopeDIE(*AI);
}
DIE *CurFnDIE = constructScopeDIE(CurrentFnDbgScope);
Added: llvm/trunk/test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll?rev=107228&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll (added)
+++ llvm/trunk/test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll Tue Jun 29 19:11:08 2010
@@ -0,0 +1,52 @@
+; RUN: llc -O2 %s -o - | FileCheck %s
+; Check struct X for dead variable xyz from inlined function foo.
+
+; CHECK: DW_TAG_structure_type
+; CHECK-NEXT: DW_AT_sibling
+; CHECK-NEXT: DW_AT_name
+
+
+ at i = common global i32 0 ; <i32*> [#uses=2]
+
+declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
+
+declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
+
+define i32 @bar() nounwind ssp {
+entry:
+ %0 = load i32* @i, align 4, !dbg !17 ; <i32> [#uses=2]
+ tail call void @llvm.dbg.value(metadata !{i32 %0}, i64 0, metadata !9), !dbg !19
+ tail call void @llvm.dbg.declare(metadata !20, metadata !10), !dbg !21
+ %1 = mul nsw i32 %0, %0, !dbg !22 ; <i32> [#uses=2]
+ store i32 %1, i32* @i, align 4, !dbg !17
+ ret i32 %1, !dbg !23
+}
+
+!llvm.dbg.sp = !{!0, !6}
+!llvm.dbg.lv.foo = !{!9, !10}
+!llvm.dbg.gv = !{!16}
+
+!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 9, metadata !3, i1 true, i1 true, i32 0, i32 0, null, i1 false, i1 true, null} ; [ DW_TAG_subprogram ]
+!1 = metadata !{i32 524329, metadata !"bar.c", metadata !"/tmp/", metadata !2} ; [ DW_TAG_file_type ]
+!2 = metadata !{i32 524305, i32 0, i32 1, metadata !"bar.c", metadata !"/tmp/", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!4 = metadata !{metadata !5, metadata !5}
+!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"bar", metadata !"bar", metadata !"bar", metadata !1, i32 14, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 ()* @bar} ; [ DW_TAG_subprogram ]
+!7 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!8 = metadata !{metadata !5}
+!9 = metadata !{i32 524545, metadata !0, metadata !"j", metadata !1, i32 9, metadata !5} ; [ DW_TAG_arg_variable ]
+!10 = metadata !{i32 524544, metadata !11, metadata !"xyz", metadata !1, i32 10, metadata !12} ; [ DW_TAG_auto_variable ]
+!11 = metadata !{i32 524299, metadata !0, i32 9, i32 0} ; [ DW_TAG_lexical_block ]
+!12 = metadata !{i32 524307, metadata !0, metadata !"X", metadata !1, i32 10, i64 64, i64 32, i64 0, i32 0, null, metadata !13, i32 0, null} ; [ DW_TAG_structure_type ]
+!13 = metadata !{metadata !14, metadata !15}
+!14 = metadata !{i32 524301, metadata !12, metadata !"a", metadata !1, i32 10, i64 32, i64 32, i64 0, i32 0, metadata !5} ; [ DW_TAG_member ]
+!15 = metadata !{i32 524301, metadata !12, metadata !"b", metadata !1, i32 10, i64 32, i64 32, i64 32, i32 0, metadata !5} ; [ DW_TAG_member ]
+!16 = metadata !{i32 524340, i32 0, metadata !1, metadata !"i", metadata !"i", metadata !"", metadata !1, i32 5, metadata !5, i1 false, i1 true, i32* @i} ; [ DW_TAG_variable ]
+!17 = metadata !{i32 15, i32 0, metadata !18, null}
+!18 = metadata !{i32 524299, metadata !6, i32 14, i32 0} ; [ DW_TAG_lexical_block ]
+!19 = metadata !{i32 9, i32 0, metadata !0, metadata !17}
+!20 = metadata !{null}
+!21 = metadata !{i32 9, i32 0, metadata !11, metadata !17}
+!22 = metadata !{i32 11, i32 0, metadata !11, metadata !17}
+!23 = metadata !{i32 16, i32 0, metadata !18, null}
More information about the llvm-commits
mailing list