[PATCH] DebugInfo: SROA on references should result in undef dbg.values
Adrian Prantl
aprantl at apple.com
Tue May 20 16:18:10 PDT 2014
As mentioned earlier, I believe that DW_TAG_struct should be part of that list.
==================================
struct S { unsigned int c; };
unsigned int foo() {
struct S s = { 42 };
return s.c;
}
And imagine a slightly smarter SROA turns this into:
==================================
; ModuleID = 's.c'
target triple = "x86_64-apple-macosx10.9.0"
%struct.S = type { i32 }
; Function Attrs: nounwind readnone ssp uwtable
define i32 @foo() #0 {
entry:
tail call void @llvm.dbg.value(metadata !17, i64 0, metadata !10), !dbg !18
ret i32 42, !dbg !19
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata) #1
attributes #0 = { nounwind readnone ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!14, !15}
!llvm.ident = !{!16}
!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.5.0 ", i1 true, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [/Volumes/Data/llvm/_build.ninja.debug/s.c] [DW_LANG_C99]
!1 = metadata !{metadata !"s.c", metadata !"/Volumes/Data/llvm/_build.ninja.debug"}
!2 = metadata !{}
!3 = metadata !{metadata !4}
!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"foo", metadata !"foo", metadata !"", i32 2, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 true, i32 ()* @foo, null, null, metadata !9, i32 2} ; [ DW_TAG_subprogram ] [line 2] [def] [foo]
!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/Volumes/Data/llvm/_build.ninja.debug/s.c]
!6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!7 = metadata !{metadata !8}
!8 = metadata !{i32 786468, null, null, metadata !"unsigned int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] [unsigned int] [line 0, size 32, align 32, offset 0, enc DW_ATE_unsigned]
!9 = metadata !{metadata !10}
!10 = metadata !{i32 786688, metadata !4, metadata !"s", metadata !5, i32 3, metadata !11, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [s] [line 3]
!11 = metadata !{i32 786451, metadata !1, null, metadata !"S", i32 1, i64 32, i64 32, i32 0, i32 0, null, metadata !12, i32 0, null, null, null} ; [ DW_TAG_structure_type ] [S] [line 1, size 32, align 32, offset 0] [def] [from ]
!12 = metadata !{metadata !13}
!13 = metadata !{i32 786445, metadata !1, metadata !11, metadata !"c", i32 1, i64 32, i64 32, i64 0, i32 0, metadata !8} ; [ DW_TAG_member ] [c] [line 1, size 32, align 32, offset 0] [from unsigned int]
!14 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
!15 = metadata !{i32 2, metadata !"Debug Info Version", i32 1}
!16 = metadata !{metadata !"clang version 3.5.0 "}
!17 = metadata !{i32 42}
!18 = metadata !{i32 3, i32 0, metadata !4, null}
!19 = metadata !{i32 4, i32 0, metadata !4, null}
==================================================
$ bin/llc s.ll
Assertion failed: (T == dwarf::DW_TAG_typedef || T == dwarf::DW_TAG_const_type || T == dwarf::DW_TAG_volatile_type || T == dwarf::DW_TAG_restrict_type || T == dwarf::DW_TAG_enumeration_type), function isUnsignedDIType, file ../lib/CodeGen/AsmPrinter/DwarfUnit.cpp, line 766.
http://reviews.llvm.org/D3714
More information about the llvm-commits
mailing list