Index: include/llvm/Config/config.h.cmake =================================================================== --- include/llvm/Config/config.h.cmake +++ include/llvm/Config/config.h.cmake @@ -420,8 +420,10 @@ /* Installation directory for data files */ #cmakedefine LLVM_DATADIR "${LLVM_DATADIR}" -/* Target triple LLVM will generate code for by default */ -#cmakedefine LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" +/* Target triple LLVM will generate code for by default + * Doesn't use `cmakedefine` because it is allowed to be empty. + */ +#define LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" /* Installation directory for documentation */ #cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}" Index: test/BugPoint/remove_arguments_test.ll =================================================================== --- test/BugPoint/remove_arguments_test.ll +++ test/BugPoint/remove_arguments_test.ll @@ -5,7 +5,7 @@ ; Test to make sure that arguments are removed from the function if they are ; unnecessary. And clean up any types that frees up too. -; CHECK: target triple +; CHECK: ModuleID ; CHECK-NOT: struct.anon %struct.anon = type { i32 } Index: test/CodeGen/Generic/lit.local.cfg =================================================================== --- test/CodeGen/Generic/lit.local.cfg +++ test/CodeGen/Generic/lit.local.cfg @@ -1,3 +1,2 @@ -if 'native' not in config.available_features: +if not config.target_triple: config.unsupported = True - Index: test/CodeGen/PowerPC/2006-01-20-ShiftPartsCrash.ll =================================================================== --- test/CodeGen/PowerPC/2006-01-20-ShiftPartsCrash.ll +++ test/CodeGen/PowerPC/2006-01-20-ShiftPartsCrash.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple define void @iterative_hash_host_wide_int() { %zero = alloca i32 ; [#uses=2] Index: test/CodeGen/PowerPC/2006-08-15-SelectionCrash.ll =================================================================== --- test/CodeGen/PowerPC/2006-08-15-SelectionCrash.ll +++ test/CodeGen/PowerPC/2006-08-15-SelectionCrash.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple %struct..0anon = type { i32 } %struct.rtx_def = type { i16, i8, i8, [1 x %struct..0anon] } Index: test/CodeGen/PowerPC/2006-12-07-LargeAlloca.ll =================================================================== --- test/CodeGen/PowerPC/2006-12-07-LargeAlloca.ll +++ test/CodeGen/PowerPC/2006-12-07-LargeAlloca.ll @@ -1,6 +1,7 @@ ; RUN: llc < %s -march=ppc64 ; RUN: llc < %s -march=ppc32 ; RUN: llc < %s +; REQUIRES: default_triple define void @bitap() { entry: Index: test/CodeGen/PowerPC/2006-12-07-SelectCrash.ll =================================================================== --- test/CodeGen/PowerPC/2006-12-07-SelectCrash.ll +++ test/CodeGen/PowerPC/2006-12-07-SelectCrash.ll @@ -1,6 +1,7 @@ ; RUN: llc < %s -march=ppc64 ; RUN: llc < %s -march=ppc32 ; RUN: llc < %s +; REQUIRES: default_triple @qsz.b = external global i1 ; [#uses=1] Index: test/CodeGen/PowerPC/2007-11-19-VectorSplitting.ll =================================================================== --- test/CodeGen/PowerPC/2007-11-19-VectorSplitting.ll +++ test/CodeGen/PowerPC/2007-11-19-VectorSplitting.ll @@ -2,6 +2,7 @@ ; RUN: llc < %s -march=ppc32 -mcpu=g3 ; RUN: llc < %s -march=ppc32 -mcpu=g5 ; PR1811 +; REQUIRES: default_triple define void @execute_shader(<4 x float>* %OUT, <4 x float>* %IN, <4 x float>* %CONST) { Index: test/CodeGen/PowerPC/load-shift-combine.ll =================================================================== --- test/CodeGen/PowerPC/load-shift-combine.ll +++ test/CodeGen/PowerPC/load-shift-combine.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple ; This used to cause a crash. A standard load is converted to a pre-increment ; load. Later the pre-increment load is combined with a subsequent SRL to Index: test/CodeGen/X86/2006-10-02-BoolRetCrash.ll =================================================================== --- test/CodeGen/X86/2006-10-02-BoolRetCrash.ll +++ test/CodeGen/X86/2006-10-02-BoolRetCrash.ll @@ -1,5 +1,6 @@ ; RUN: llc < %s ; PR933 +; REQUIRES: default_triple define fastcc i1 @test() { ret i1 true Index: test/CodeGen/X86/2009-06-05-VariableIndexInsert.ll =================================================================== --- test/CodeGen/X86/2009-06-05-VariableIndexInsert.ll +++ test/CodeGen/X86/2009-06-05-VariableIndexInsert.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple define <2 x i64> @_mm_insert_epi16(<2 x i64> %a, i32 %b, i32 %imm) nounwind readnone { entry: Index: test/CodeGen/X86/2009-06-06-ConcatVectors.ll =================================================================== --- test/CodeGen/X86/2009-06-06-ConcatVectors.ll +++ test/CodeGen/X86/2009-06-06-ConcatVectors.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple define <2 x i64> @_mm_movpi64_pi64(<1 x i64> %a, <1 x i64> %b) nounwind readnone { entry: Index: test/CodeGen/X86/2010-02-01-DbgValueCrash.ll =================================================================== --- test/CodeGen/X86/2010-02-01-DbgValueCrash.ll +++ test/CodeGen/X86/2010-02-01-DbgValueCrash.ll @@ -1,4 +1,6 @@ ; RUN: llc -O1 < %s +; REQUIRES: default_triple + ; ModuleID = 'pr6157.bc' ; formerly crashed in SelectionDAGBuilder Index: test/CodeGen/X86/2010-07-06-DbgCrash.ll =================================================================== --- test/CodeGen/X86/2010-07-06-DbgCrash.ll +++ test/CodeGen/X86/2010-07-06-DbgCrash.ll @@ -1,4 +1,5 @@ ; RUN: llc -O0 -relocation-model pic < %s -o /dev/null +; REQUIRES: default_triple ; PR7545 @.str = private constant [4 x i8] c"one\00", align 1 ; <[4 x i8]*> [#uses=1] @.str1 = private constant [4 x i8] c"two\00", align 1 ; <[5 x i8]*> [#uses=1] Index: test/CodeGen/X86/GC/alloc_loop.ll =================================================================== --- test/CodeGen/X86/GC/alloc_loop.ll +++ test/CodeGen/X86/GC/alloc_loop.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple declare i8* @llvm_gc_allocate(i32) Index: test/CodeGen/X86/GC/cg-O0.ll =================================================================== --- test/CodeGen/X86/GC/cg-O0.ll +++ test/CodeGen/X86/GC/cg-O0.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s -O0 +; REQUIRES: default_triple define i32 @main() { entry: Index: test/CodeGen/X86/GC/lower_gcroot.ll =================================================================== --- test/CodeGen/X86/GC/lower_gcroot.ll +++ test/CodeGen/X86/GC/lower_gcroot.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple %Env = type i8* Index: test/CodeGen/X86/extractelement-shuffle.ll =================================================================== --- test/CodeGen/X86/extractelement-shuffle.ll +++ test/CodeGen/X86/extractelement-shuffle.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple ; Examples that exhibits a bug in DAGCombine. The case is triggered by the ; following program. The bug is DAGCombine assumes that the bit convert Index: test/CodeGen/X86/vshift_scalar.ll =================================================================== --- test/CodeGen/X86/vshift_scalar.ll +++ test/CodeGen/X86/vshift_scalar.ll @@ -1,4 +1,5 @@ ; RUN: llc < %s +; REQUIRES: default_triple ; Legalization test that requires scalarizing a vector. Index: test/DebugInfo/2009-10-16-Phi.ll =================================================================== --- /dev/null +++ test/DebugInfo/2009-10-16-Phi.ll @@ -1,13 +0,0 @@ -; RUN: llvm-as %s -disable-output - -define i32 @foo() { -E: - br label %B2 -B1: - br label %B2 -B2: - %0 = phi i32 [ 0, %E ], [ 1, %B1 ], !dbg !0 - ret i32 %0 -} - -!0 = !{i32 42} Index: test/DebugInfo/2009-11-03-InsertExtractValue.ll =================================================================== --- /dev/null +++ test/DebugInfo/2009-11-03-InsertExtractValue.ll @@ -1,23 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis | FileCheck %s - -!llvm.dbg.sp = !{!0} -!llvm.dbg.cu = !{!5} -!llvm.module.flags = !{!6} - -!0 = !DISubprogram(name: "bar", linkageName: "_ZN3foo3barEv", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagProtected | DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !4, scope: !1, type: !2) -!1 = !DIFile(filename: "/foo", directory: "bar.cpp") -!2 = !DISubroutineType(types: !3) -!3 = !{null} -!4 = !DIFile(filename: "/foo", directory: "bar.cpp") -!5 = distinct !DICompileUnit(language: DW_LANG_C99, isOptimized: true, emissionKind: 0, file: !4, enums: !{}, retainedTypes: !{}) - -define <{i32, i32}> @f1() { -; CHECK: !dbgx ![[NUMBER:[0-9]+]] - %r = insertvalue <{ i32, i32 }> zeroinitializer, i32 4, 1, !dbgx !1 -; CHECK: !dbgx ![[NUMBER]] - %e = extractvalue <{ i32, i32 }> %r, 0, !dbgx !1 - ret <{ i32, i32 }> %r -} - -; CHECK: DIFlagProtected -!6 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2009-11-05-DeadGlobalVariable.ll =================================================================== --- /dev/null +++ test/DebugInfo/2009-11-05-DeadGlobalVariable.ll @@ -1,26 +0,0 @@ -; RUN: llc %s -o /dev/null -; Here variable bar is optimized away. Do not trip over while trying to generate debug info. - - -define i32 @foo() nounwind uwtable readnone ssp { -entry: - ret i32 42, !dbg !15 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!18} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 139632)", isOptimized: true, emissionKind: 0, file: !17, enums: !1, retainedTypes: !1, subprograms: !3, globals: !12) -!1 = !{} -!3 = !{!5} -!5 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, file: !17, scope: !6, type: !7, function: i32 ()* @foo) -!6 = !DIFile(filename: "fb.c", directory: "/private/tmp") -!7 = !DISubroutineType(types: !8) -!8 = !{!9} -!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!12 = !{!14} -!14 = !DIGlobalVariable(name: "bar", line: 2, isLocal: true, isDefinition: true, scope: !5, file: !6, type: !9) -!15 = !DILocation(line: 3, column: 3, scope: !16) -!16 = distinct !DILexicalBlock(line: 1, column: 11, file: !17, scope: !5) -!17 = !DIFile(filename: "fb.c", directory: "/private/tmp") -!18 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll =================================================================== --- /dev/null +++ test/DebugInfo/2009-11-06-NamelessGlobalVariable.ll @@ -1,14 +0,0 @@ -; RUN: llc %s -o /dev/null -@0 = internal constant i32 1 - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!9} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 139632)", isOptimized: true, emissionKind: 0, file: !8, enums: !2, retainedTypes: !2, subprograms: !2, globals: !3) -!2 = !{} -!3 = !{!5} -!5 = !DIGlobalVariable(name: "a", line: 2, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: i32* @0) -!6 = !DIFile(filename: "g.c", directory: "/private/tmp") -!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!8 = !DIFile(filename: "g.c", directory: "/private/tmp") -!9 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2009-11-10-CurrentFn.ll =================================================================== --- /dev/null +++ test/DebugInfo/2009-11-10-CurrentFn.ll @@ -1,31 +0,0 @@ -; RUN: llc < %s -o /dev/null - -define void @bar(i32 %i) nounwind uwtable ssp { -entry: - tail call void (...) @foo() nounwind, !dbg !14 - ret void, !dbg !16 -} - -declare void @foo(...) - -declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!18} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 139632)", isOptimized: true, emissionKind: 0, file: !17, enums: !1, retainedTypes: !1, subprograms: !3, globals: !1) -!1 = !{} -!3 = !{!5} -!5 = distinct !DISubprogram(name: "bar", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, file: !17, scope: !6, type: !7, function: void (i32)* @bar, variables: !9) -!6 = !DIFile(filename: "cf.c", directory: "/private/tmp") -!7 = !DISubroutineType(types: !8) -!8 = !{null} -!9 = !{!11} -!11 = !DILocalVariable(name: "i", line: 3, arg: 1, scope: !5, file: !17, type: !12) -!12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!13 = !DILocation(line: 3, column: 14, scope: !5) -!14 = !DILocation(line: 4, column: 3, scope: !15) -!15 = distinct !DILexicalBlock(line: 3, column: 17, file: !17, scope: !5) -!16 = !DILocation(line: 5, column: 1, scope: !15) -!17 = !DIFile(filename: "cf.c", directory: "/private/tmp") -!18 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-01-05-DbgScope.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-01-05-DbgScope.ll @@ -1,25 +0,0 @@ -; RUN: llc < %s -o /dev/null -; PR 5942 -define i8* @foo() nounwind { -entry: - %0 = load i32, i32* undef, align 4, !dbg !0 ; [#uses=1] - %1 = inttoptr i32 %0 to i8*, !dbg !0 ; [#uses=1] - ret i8* %1, !dbg !10 - -} - -!llvm.dbg.cu = !{!3} -!llvm.module.flags = !{!14} - -!0 = !DILocation(line: 571, column: 3, scope: !1) -!1 = distinct !DILexicalBlock(line: 1, column: 1, file: !11, scope: !2) -!2 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 561, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !3, type: !4) -!3 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang 1.1", isOptimized: true, emissionKind: 0, file: !11, enums: !12, retainedTypes: !12, subprograms: !13) -!4 = !DISubroutineType(types: !5) -!5 = !{!6} -!6 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) -!10 = !DILocation(line: 588, column: 1, scope: !2) -!11 = !DIFile(filename: "hashtab.c", directory: "/usr/src/gnu/usr.bin/cc/cc_tools/../../../../contrib/gcclibs/libiberty") -!12 = !{} -!13 = !{!2} -!14 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-03-12-llc-crash.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-03-12-llc-crash.ll @@ -1,22 +0,0 @@ -; RUN: llc -O0 < %s -o /dev/null -; llc should not crash on this optimized out debug info. -; PR6588 -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -define void @foo() { -entry: - call void @llvm.dbg.declare(metadata i32* undef, metadata !0, metadata !DIExpression()), !dbg !DILocation(scope: !1) - ret void -} - -!0 = !DILocalVariable(name: "sy", line: 890, arg: 1, scope: !1, file: !2, type: !7) -!1 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 892, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !8, scope: !3, type: !4) -!2 = !DIFile(filename: "qpainter.h", directory: "QtGui") -!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang 1.1", isOptimized: true, emissionKind: 0, file: !9, enums: !10, retainedTypes: !10) -!4 = !DISubroutineType(types: !6) -!5 = !DIFile(filename: "splineeditor.cpp", directory: "src") -!6 = !{null} -!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!8 = !DIFile(filename: "qpainter.h", directory: "QtGui") -!9 = !DIFile(filename: "splineeditor.cpp", directory: "src") -!10 = !{i32 0} Index: test/DebugInfo/2010-03-19-DbgDeclare.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-03-19-DbgDeclare.ll @@ -1,20 +0,0 @@ -; RUN: opt < %s -verify -S | FileCheck %s - -; CHECK: DW_LANG_Mips_Assembler - -define void @Foo(i32 %a, i32 %b) { -entry: - call void @llvm.dbg.declare(metadata i32* null, metadata !1, metadata !DIExpression()), !dbg !DILocation(scope: !6) - ret void -} -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!5} -!2 = distinct !DICompileUnit(language: DW_LANG_Mips_Assembler, producer: "clang version 3.3 ", isOptimized: false, emissionKind: 1, file: !4, enums: !3, retainedTypes: !3, subprograms: !3, globals: !3, imports: !3) -!3 = !{} -!0 = !DILocation(line: 662302, column: 26, scope: !1) -!1 = !DILocalVariable(name: "foo", scope: !6) -!4 = !DIFile(filename: "scratch.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch") -!6 = distinct !DISubprogram() - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone -!5 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-03-24-MemberFn.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-03-24-MemberFn.ll @@ -1,70 +0,0 @@ -; RUN: %llc_dwarf -O0 < %s | grep AT_decl_file | grep 2 -; Here _ZN1S3fooEv is defined in header file identified as AT_decl_file no. 2 in debug info. -%struct.S = type <{ i8 }> - -define i32 @_Z3barv() nounwind ssp { -entry: - %retval = alloca i32 ; [#uses=2] - %0 = alloca i32 ; [#uses=2] - %s1 = alloca %struct.S ; <%struct.S*> [#uses=1] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.declare(metadata %struct.S* %s1, metadata !0, metadata !DIExpression()), !dbg !16 - %1 = call i32 @_ZN1S3fooEv(%struct.S* %s1) nounwind, !dbg !17 ; [#uses=1] - store i32 %1, i32* %0, align 4, !dbg !17 - %2 = load i32, i32* %0, align 4, !dbg !17 ; [#uses=1] - store i32 %2, i32* %retval, align 4, !dbg !17 - br label %return, !dbg !17 - -return: ; preds = %entry - %retval1 = load i32, i32* %retval, !dbg !17 ; [#uses=1] - ret i32 %retval1, !dbg !16 -} - -define linkonce_odr i32 @_ZN1S3fooEv(%struct.S* %this) nounwind ssp align 2 { -entry: - %this_addr = alloca %struct.S* ; <%struct.S**> [#uses=1] - %retval = alloca i32 ; [#uses=1] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.declare(metadata %struct.S** %this_addr, metadata !18, metadata !DIExpression()), !dbg !21 - store %struct.S* %this, %struct.S** %this_addr - br label %return, !dbg !21 - -return: ; preds = %entry - %retval1 = load i32, i32* %retval, !dbg !21 ; [#uses=1] - ret i32 %retval1, !dbg !22 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -!llvm.dbg.cu = !{!5} -!llvm.module.flags = !{!28} - -!0 = !DILocalVariable(name: "s1", line: 3, scope: !1, file: !4, type: !9) -!1 = distinct !DILexicalBlock(line: 3, column: 0, file: !25, scope: !2) -!2 = distinct !DILexicalBlock(line: 3, column: 0, file: !25, scope: !3) -!3 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 3, file: !25, scope: !4, type: !6, function: i32 ()* @_Z3barv) -!4 = !DIFile(filename: "one.cc", directory: "/tmp/") -!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: 0, file: !25, enums: !27, retainedTypes: !27, subprograms: !24, imports: null) -!6 = !DISubroutineType(types: !7) -!7 = !{!8} -!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 2, size: 8, align: 8, file: !26, scope: !4, elements: !11) -!10 = !DIFile(filename: "one.h", directory: "/tmp/") -!11 = !{!12} -!12 = distinct !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 3, file: !26, scope: !9, type: !13, function: i32 (%struct.S*)* @_ZN1S3fooEv) -!13 = !DISubroutineType(types: !14) -!14 = !{!8, !15} -!15 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !25, scope: !4, baseType: !9) -!16 = !DILocation(line: 3, scope: !1) -!17 = !DILocation(line: 3, scope: !3) -!18 = !DILocalVariable(name: "this", line: 3, arg: 1, scope: !12, file: !10, type: !19) -!19 = !DIDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !25, scope: !4, baseType: !20) -!20 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !25, scope: !4, baseType: !9) -!21 = !DILocation(line: 3, scope: !12) -!22 = !DILocation(line: 3, scope: !23) -!23 = distinct !DILexicalBlock(line: 3, column: 0, file: !26, scope: !12) -!24 = !{!3, !12} -!25 = !DIFile(filename: "one.cc", directory: "/tmp/") -!26 = !DIFile(filename: "one.h", directory: "/tmp/") -!27 = !{} -!28 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll @@ -1,112 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj -o - < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s -; Radar 7833483 -; Do not emit a separate out-of-line definition DIE for the function-local 'foo' -; function (member of the function local 'A' type) -; CHECK: DW_TAG_class_type -; CHECK: DW_TAG_class_type -; CHECK-NEXT: DW_AT_name {{.*}} "A" -; Check that the subprogram inside the class definition has low_pc, only -; attached to the definition. -; CHECK: [[FOO_INL:0x........]]: DW_TAG_subprogram -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_low_pc -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "foo" -; And just double check that there's no out of line definition that references -; this subprogram. -; CHECK-NOT: DW_AT_specification {{.*}} {[[FOO_INL]]} - -%class.A = type { i8 } -%class.B = type { i8 } - -define i32 @main() ssp { -entry: - %retval = alloca i32, align 4 ; [#uses=3] - %b = alloca %class.A, align 1 ; <%class.A*> [#uses=1] - store i32 0, i32* %retval - call void @llvm.dbg.declare(metadata %class.A* %b, metadata !0, metadata !DIExpression()), !dbg !14 - %call = call i32 @_ZN1B2fnEv(%class.A* %b), !dbg !15 ; [#uses=1] - store i32 %call, i32* %retval, !dbg !15 - %0 = load i32, i32* %retval, !dbg !16 ; [#uses=1] - ret i32 %0, !dbg !16 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -define linkonce_odr i32 @_ZN1B2fnEv(%class.A* %this) ssp align 2 { -entry: - %retval = alloca i32, align 4 ; [#uses=2] - %this.addr = alloca %class.A*, align 8 ; <%class.A**> [#uses=2] - %a = alloca %class.A, align 1 ; <%class.A*> [#uses=1] - %i = alloca i32, align 4 ; [#uses=2] - store %class.A* %this, %class.A** %this.addr - call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !17, metadata !DIExpression()), !dbg !18 - %this1 = load %class.A*, %class.A** %this.addr ; <%class.A*> [#uses=0] - call void @llvm.dbg.declare(metadata %class.A* %a, metadata !19, metadata !DIExpression()), !dbg !27 - call void @llvm.dbg.declare(metadata i32* %i, metadata !28, metadata !DIExpression()), !dbg !29 - %call = call i32 @_ZZN1B2fnEvEN1A3fooEv(%class.A* %a), !dbg !30 ; [#uses=1] - store i32 %call, i32* %i, !dbg !30 - %tmp = load i32, i32* %i, !dbg !31 ; [#uses=1] - store i32 %tmp, i32* %retval, !dbg !31 - %0 = load i32, i32* %retval, !dbg !32 ; [#uses=1] - ret i32 %0, !dbg !32 -} - -define internal i32 @_ZZN1B2fnEvEN1A3fooEv(%class.A* %this) ssp align 2 { -entry: - %retval = alloca i32, align 4 ; [#uses=2] - %this.addr = alloca %class.A*, align 8 ; <%class.A**> [#uses=2] - store %class.A* %this, %class.A** %this.addr - call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !33, metadata !DIExpression()), !dbg !34 - %this1 = load %class.A*, %class.A** %this.addr ; <%class.A*> [#uses=0] - store i32 42, i32* %retval, !dbg !35 - %0 = load i32, i32* %retval, !dbg !35 ; [#uses=1] - ret i32 %0, !dbg !35 -} - -!llvm.dbg.cu = !{!4} -!llvm.module.flags = !{!40} -!37 = !{!2, !10, !23} - -!0 = !DILocalVariable(name: "b", line: 16, scope: !1, file: !3, type: !8) -!1 = distinct !DILexicalBlock(line: 15, column: 12, file: !38, scope: !2) -!2 = distinct !DISubprogram(name: "main", linkageName: "main", line: 15, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 15, file: !38, scope: !3, type: !5, function: i32 ()* @main) -!3 = !DIFile(filename: "one.cc", directory: "/tmp") -!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang 1.5", isOptimized: false, emissionKind: 0, file: !38, enums: !39, retainedTypes: !39, subprograms: !37, imports: null) -!5 = !DISubroutineType(types: !6) -!6 = !{!7} -!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!8 = !DICompositeType(tag: DW_TAG_class_type, name: "B", line: 2, size: 8, align: 8, file: !38, scope: !3, elements: !9) -!9 = !{!10} -!10 = distinct !DISubprogram(name: "fn", linkageName: "_ZN1B2fnEv", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 4, file: !38, scope: !8, type: !11, function: i32 (%class.A*)* @_ZN1B2fnEv) -!11 = !DISubroutineType(types: !12) -!12 = !{!7, !13} -!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !38, scope: !3, baseType: !8) -!14 = !DILocation(line: 16, column: 5, scope: !1) -!15 = !DILocation(line: 17, column: 3, scope: !1) -!16 = !DILocation(line: 18, column: 1, scope: !2) -!17 = !DILocalVariable(name: "this", line: 4, arg: 1, scope: !10, file: !3, type: !13) -!18 = !DILocation(line: 4, column: 7, scope: !10) -!19 = !DILocalVariable(name: "a", line: 9, scope: !20, file: !3, type: !21) -!20 = distinct !DILexicalBlock(line: 4, column: 12, file: !38, scope: !10) -!21 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 5, size: 8, align: 8, file: !38, scope: !10, elements: !22) -!22 = !{!23} -!23 = distinct !DISubprogram(name: "foo", linkageName: "_ZZN1B2fnEvEN1A3fooEv", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 7, file: !38, scope: !21, type: !24, function: i32 (%class.A*)* @_ZZN1B2fnEvEN1A3fooEv) -!24 = !DISubroutineType(types: !25) -!25 = !{!7, !26} -!26 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !38, scope: !3, baseType: !21) -!27 = !DILocation(line: 9, column: 7, scope: !20) -!28 = !DILocalVariable(name: "i", line: 10, scope: !20, file: !3, type: !7) -!29 = !DILocation(line: 10, column: 9, scope: !20) -!30 = !DILocation(line: 10, column: 5, scope: !20) -!31 = !DILocation(line: 11, column: 5, scope: !20) -!32 = !DILocation(line: 12, column: 3, scope: !10) -!33 = !DILocalVariable(name: "this", line: 7, arg: 1, scope: !23, file: !3, type: !26) -!34 = !DILocation(line: 7, column: 11, scope: !23) -!35 = !DILocation(line: 7, column: 19, scope: !36) -!36 = distinct !DILexicalBlock(line: 7, column: 17, file: !38, scope: !23) -!38 = !DIFile(filename: "one.cc", directory: "/tmp") -!39 = !{} -!40 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-04-19-FramePtr.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-04-19-FramePtr.ll @@ -1,37 +0,0 @@ -; RUN: %llc_dwarf -asm-verbose -O1 -o %t < %s -; RUN: grep DW_AT_APPLE_omit_frame_ptr %t -; RUN: %llc_dwarf -disable-fp-elim -asm-verbose -O1 -o %t < %s -; RUN: grep -v DW_AT_APPLE_omit_frame_ptr %t - - -define i32 @foo() nounwind ssp { -entry: - %retval = alloca i32 ; [#uses=2] - %0 = alloca i32 ; [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store i32 42, i32* %0, align 4, !dbg !0 - %1 = load i32, i32* %0, align 4, !dbg !0 ; [#uses=1] - store i32 %1, i32* %retval, align 4, !dbg !0 - br label %return, !dbg !0 - -return: ; preds = %entry - %retval1 = load i32, i32* %retval, !dbg !0 ; [#uses=1] - ret i32 %retval1, !dbg !7 -} - -!llvm.dbg.cu = !{!3} -!llvm.module.flags = !{!12} -!9 = !{!1} - -!0 = !DILocation(line: 2, scope: !1) -!1 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 2, file: !10, scope: null, type: !4, function: i32 ()* @foo) -!2 = !DIFile(filename: "a.c", directory: "/tmp") -!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: 0, file: !10, enums: !11, retainedTypes: !11, subprograms: !9, imports: null) -!4 = !DISubroutineType(types: !5) -!5 = !{!6} -!6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!7 = !DILocation(line: 2, scope: !8) -!8 = distinct !DILexicalBlock(line: 2, column: 0, file: !10, scope: !1) -!10 = !DIFile(filename: "a.c", directory: "/tmp") -!11 = !{} -!12 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-05-03-DisableFramePtr.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-05-03-DisableFramePtr.ll @@ -1,40 +0,0 @@ -; RUN: llc -o /dev/null < %s -; Radar 7937664 -%struct.AppleEvent = type opaque - -define void @DisposeDMNotificationUPP(void (%struct.AppleEvent*)* %userUPP) "no-frame-pointer-elim-non-leaf" nounwind ssp { -entry: - %userUPP_addr = alloca void (%struct.AppleEvent*)* ; [#uses=1] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.declare(metadata void (%struct.AppleEvent*)** %userUPP_addr, metadata !0, metadata !DIExpression()), !dbg !13 - store void (%struct.AppleEvent*)* %userUPP, void (%struct.AppleEvent*)** %userUPP_addr - br label %return, !dbg !14 - -return: ; preds = %entry - ret void, !dbg !14 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -!llvm.dbg.cu = !{!3} -!llvm.module.flags = !{!19} -!0 = !DILocalVariable(name: "userUPP", line: 7, arg: 1, scope: !1, file: !2, type: !6) -!1 = distinct !DISubprogram(name: "DisposeDMNotificationUPP", linkageName: "DisposeDMNotificationUPP", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !16, scope: null, type: !4) -!2 = !DIFile(filename: "t.c", directory: "/Users/echeng/LLVM/radars/r7937664/") -!3 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build 9999)", isOptimized: true, emissionKind: 0, file: !16, enums: !17, retainedTypes: !17, subprograms: !18) -!4 = !DISubroutineType(types: !5) -!5 = !{null, !6} -!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "DMNotificationUPP", line: 6, file: !16, scope: !2, baseType: !7) -!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !16, scope: !2, baseType: !8) -!8 = !DISubroutineType(types: !9) -!9 = !{null, !10} -!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !16, scope: !2, baseType: !11) -!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "AppleEvent", line: 4, file: !16, scope: !2, baseType: !12) -!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "AEDesc", line: 1, flags: DIFlagFwdDecl, file: !16, scope: !2) -!13 = !DILocation(line: 7, scope: !1) -!14 = !DILocation(line: 8, scope: !15) -!15 = distinct !DILexicalBlock(line: 7, column: 0, file: !16, scope: !1) -!16 = !DIFile(filename: "t.c", directory: "/Users/echeng/LLVM/radars/r7937664/") -!17 = !{} -!18 = !{!1} -!19 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-05-03-OriginDIE.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-05-03-OriginDIE.ll @@ -1,94 +0,0 @@ - -;RUN: llc < %s -o /dev/null -;Radar 7937109 - -%struct.anon = type { i64, i32, i32, i32, [1 x i32] } -%struct.gpm_t = type { i32, i8*, [16 x i8], i32, i64, i64, i64, i64, i64, i64, i32, i16, i16, [8 x %struct.gpmr_t] } -%struct.gpmr_t = type { [48 x i8], [48 x i8], [16 x i8], i64, i64, i64, i64, i16 } -%struct.gpt_t = type { [8 x i8], i32, i32, i32, i32, i64, i64, i64, i64, [16 x i8], %struct.anon } - -@llvm.used = appending global [1 x i8*] [i8* bitcast (void (%struct.gpm_t*, %struct.gpt_t*)* @gpt2gpm to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] - -define fastcc void @gpt2gpm(%struct.gpm_t* %gpm, %struct.gpt_t* %gpt) nounwind optsize ssp { -entry: - %data_addr.i18 = alloca i64, align 8 ; [#uses=1] - %data_addr.i17 = alloca i64, align 8 ; [#uses=2] - %data_addr.i16 = alloca i64, align 8 ; [#uses=0] - %data_addr.i15 = alloca i32, align 4 ; [#uses=0] - %data_addr.i = alloca i64, align 8 ; [#uses=0] - %0 = getelementptr inbounds %struct.gpm_t, %struct.gpm_t* %gpm, i32 0, i32 2, i32 0 ; [#uses=1] - %1 = getelementptr inbounds %struct.gpt_t, %struct.gpt_t* %gpt, i32 0, i32 9, i32 0 ; [#uses=1] - call void @uuid_LtoB(i8* %0, i8* %1) nounwind, !dbg !0 - %a9 = load volatile i64, i64* %data_addr.i18, align 8 ; [#uses=1] - %a10 = call i64 @llvm.bswap.i64(i64 %a9) nounwind ; [#uses=1] - %a11 = getelementptr inbounds %struct.gpt_t, %struct.gpt_t* %gpt, i32 0, i32 8, !dbg !7 ; [#uses=1] - %a12 = load i64, i64* %a11, align 4, !dbg !7 ; [#uses=1] - call void @llvm.dbg.declare(metadata i64* %data_addr.i17, metadata !8, metadata !DIExpression()) nounwind, !dbg !14 - store i64 %a12, i64* %data_addr.i17, align 8 - call void @llvm.dbg.value(metadata !6, i64 0, metadata !15, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !16) - call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !19, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !16) - call void @llvm.dbg.declare(metadata !6, metadata !23, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !24) - call void @llvm.dbg.value(metadata i64* %data_addr.i17, i64 0, metadata !34, metadata !DIExpression()) nounwind, !dbg !DILocation(scope: !24) - %a13 = load volatile i64, i64* %data_addr.i17, align 8 ; [#uses=1] - %a14 = call i64 @llvm.bswap.i64(i64 %a13) nounwind ; [#uses=2] - %a15 = add i64 %a10, %a14, !dbg !7 ; [#uses=1] - %a16 = sub i64 %a15, %a14 ; [#uses=1] - %a17 = getelementptr inbounds %struct.gpm_t, %struct.gpm_t* %gpm, i32 0, i32 5, !dbg !7 ; [#uses=1] - store i64 %a16, i64* %a17, align 4, !dbg !7 - ret void, !dbg !7 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone - -declare i32 @llvm.bswap.i32(i32) nounwind readnone - -declare i64 @llvm.bswap.i64(i64) nounwind readnone - -declare void @uuid_LtoB(i8*, i8*) - -!llvm.dbg.cu = !{!4} -!llvm.module.flags = !{!41} -!0 = !DILocation(line: 808, scope: !1) -!1 = distinct !DILexicalBlock(line: 807, column: 0, file: !39, scope: !2) -!2 = distinct !DISubprogram(name: "gpt2gpm", linkageName: "gpt2gpm", line: 807, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !39, scope: null, type: !5) -!3 = !DIFile(filename: "G.c", directory: "/tmp") -!4 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "llvm-gcc", isOptimized: true, emissionKind: 0, file: !39, enums: !18, retainedTypes: !18, subprograms: !40) -!5 = !DISubroutineType(types: !6) -!6 = !{null} -!7 = !DILocation(line: 810, scope: !1) -!8 = !DILocalVariable(name: "data", line: 201, arg: 1, scope: !9, file: !10, type: !11) -!9 = distinct !DISubprogram(name: "_OSSwapInt64", linkageName: "_OSSwapInt64", line: 202, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !10, scope: null, type: !5) -!10 = !DIFile(filename: "OSByteOrder.h", directory: "/usr/include/libkern/ppc") -!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint64_t", line: 59, file: !36, scope: !3, baseType: !13) -!12 = !DIFile(filename: "stdint.h", directory: "/usr/4.2.1/include") -!13 = !DIBasicType(tag: DW_TAG_base_type, name: "long long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned) -!14 = !DILocation(line: 202, scope: !9, inlinedAt: !7) -!15 = !DILocalVariable(name: "base", line: 92, arg: 2, scope: !16, file: !10, type: !17) -!16 = distinct !DISubprogram(name: "OSReadSwapInt64", linkageName: "OSReadSwapInt64", line: 95, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !38, scope: null, type: !5) -!17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !39, scope: !3, baseType: null) -!18 = !{} -!19 = !DILocalVariable(name: "byteOffset", line: 94, arg: 3, scope: !16, file: !10, type: !20) -!20 = !DIDerivedType(tag: DW_TAG_typedef, name: "uintptr_t", line: 114, file: !37, scope: !3, baseType: !22) -!21 = !DIFile(filename: "types.h", directory: "/usr/include/ppc") -!22 = !DIBasicType(tag: DW_TAG_base_type, name: "long unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned) -!23 = !DILocalVariable(name: "u", line: 100, scope: !24, file: !10, type: !25) -!24 = distinct !DILexicalBlock(line: 95, column: 0, file: !38, scope: !16) -!25 = !DICompositeType(tag: DW_TAG_union_type, line: 97, size: 64, align: 64, file: !38, scope: !16, elements: !26) -!26 = !{!27, !28} -!27 = !DIDerivedType(tag: DW_TAG_member, name: "u64", line: 98, size: 64, align: 64, file: !38, scope: !25, baseType: !11) -!28 = !DIDerivedType(tag: DW_TAG_member, name: "u32", line: 99, size: 64, align: 32, file: !38, scope: !25, baseType: !29) -!29 = !DICompositeType(tag: DW_TAG_array_type, size: 64, align: 32, file: !39, scope: !3, baseType: !30, elements: !32) -!30 = !DIDerivedType(tag: DW_TAG_typedef, name: "uint32_t", line: 55, file: !36, scope: !3, baseType: !31) -!31 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned) -!32 = !{!33} -!33 = !DISubrange(count: 2) -!34 = !DILocalVariable(name: "addr", line: 96, scope: !24, file: !10, type: !35) -!35 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !39, scope: !3, baseType: !11) -!36 = !DIFile(filename: "stdint.h", directory: "/usr/4.2.1/include") -!37 = !DIFile(filename: "types.h", directory: "/usr/include/ppc") -!38 = !DIFile(filename: "OSByteOrder.h", directory: "/usr/include/libkern/ppc") -!39 = !DIFile(filename: "G.c", directory: "/tmp") -!40 = !{!2, !9, !16} -!41 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-05-10-MultipleCU.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-05-10-MultipleCU.ll @@ -1,44 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; Check that two compile units are generated - -; CHECK: Compile Unit: -; CHECK: Compile Unit: - -define i32 @foo() nounwind readnone ssp { -return: - ret i32 42, !dbg !0 -} - -define i32 @bar() nounwind readnone ssp { -return: - ret i32 21, !dbg !8 -} - -!llvm.dbg.cu = !{!4, !12} -!llvm.module.flags = !{!21} -!16 = !{!2} -!17 = !{!10} - -!0 = !DILocation(line: 3, scope: !1) -!1 = distinct !DILexicalBlock(line: 2, column: 0, file: !18, scope: !2) -!2 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !18, scope: !3, type: !5, function: i32 ()* @foo) -!3 = !DIFile(filename: "a.c", directory: "/tmp/") -!4 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: 0, file: !18, enums: !19, retainedTypes: !19, subprograms: !16) -!5 = !DISubroutineType(types: !6) -!6 = !{!7} -!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!8 = !DILocation(line: 3, scope: !9) -!9 = distinct !DILexicalBlock(line: 2, column: 0, file: !20, scope: !10) -!10 = distinct !DISubprogram(name: "bar", linkageName: "bar", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !20, scope: !11, type: !13, function: i32 ()* @bar) -!11 = !DIFile(filename: "b.c", directory: "/tmp/") -!12 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: 0, file: !20, enums: !19, retainedTypes: !19, subprograms: !17) -!13 = !DISubroutineType(types: !14) -!14 = !{!15} -!15 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!18 = !DIFile(filename: "a.c", directory: "/tmp/") -!19 = !{} -!20 = !DIFile(filename: "b.c", directory: "/tmp/") -!21 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-06-29-InlinedFnLocalVar.ll @@ -1,61 +0,0 @@ -; RUN: %llc_dwarf -O2 %s -o - | FileCheck %s -; Check struct X for dead variable xyz from inlined function foo. - -; CHECK: section_info -; CHECK: DW_TAG_structure_type -; CHECK-NEXT: DW_AT_name - - -@i = common global i32 0 ; [#uses=2] - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone - -define i32 @bar() nounwind ssp { -entry: - %0 = load i32, i32* @i, align 4, !dbg !17 ; [#uses=2] - tail call void @llvm.dbg.value(metadata i32 %0, i64 0, metadata !59, metadata !DIExpression()), !dbg !19 - tail call void @llvm.dbg.declare(metadata !29, metadata !60, metadata !DIExpression()), !dbg !21 - %1 = mul nsw i32 %0, %0, !dbg !22 ; [#uses=2] - store i32 %1, i32* @i, align 4, !dbg !17 - ret i32 %1, !dbg !23 -} - -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!28} - -!0 = distinct !DISubprogram(name: "foo", line: 9, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 9, file: !27, scope: !1, type: !3, variables: !24) -!1 = !DIFile(filename: "bar.c", directory: "/tmp/") -!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: 0, file: !27, enums: !20, retainedTypes: !20, subprograms: !25, globals: !26, imports: !20) -!3 = !DISubroutineType(types: !4) -!4 = !{!5, !5} -!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!6 = distinct !DISubprogram(name: "bar", linkageName: "bar", line: 14, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, file: !27, scope: !1, type: !7, function: i32 ()* @bar) -!7 = !DISubroutineType(types: !8) -!8 = !{!5} -!9 = !DILocalVariable(name: "j", line: 9, arg: 1, scope: !0, file: !1, type: !5) -!10 = !DILocalVariable(name: "xyz", line: 10, scope: !11, file: !1, type: !12) - -!59 = !DILocalVariable(name: "j", line: 9, arg: 1, scope: !0, file: !1, type: !5) -!60 = !DILocalVariable(name: "xyz", line: 10, scope: !11, file: !1, type: !12) - -!11 = distinct !DILexicalBlock(line: 9, column: 0, file: !1, scope: !0) -!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", line: 10, size: 64, align: 32, file: !27, scope: !0, elements: !13) -!13 = !{!14, !15} -!14 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 10, size: 32, align: 32, file: !27, scope: !12, baseType: !5) -!15 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 10, size: 32, align: 32, offset: 32, file: !27, scope: !12, baseType: !5) -!16 = !DIGlobalVariable(name: "i", line: 5, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !5, variable: i32* @i) -!17 = !DILocation(line: 15, scope: !18) -!18 = distinct !DILexicalBlock(line: 14, column: 0, file: !1, scope: !6) -!19 = !DILocation(line: 9, scope: !0, inlinedAt: !17) -!20 = !{} -!21 = !DILocation(line: 9, scope: !11, inlinedAt: !17) -!22 = !DILocation(line: 11, scope: !11, inlinedAt: !17) -!23 = !DILocation(line: 16, scope: !18) -!24 = !{!9, !10} -!25 = !{!0, !6} -!26 = !{!16} -!27 = !DIFile(filename: "bar.c", directory: "/tmp/") -!28 = !{i32 1, !"Debug Info Version", i32 3} -!29 = !{null} Index: test/DebugInfo/2010-07-19-Crash.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-07-19-Crash.ll @@ -1,30 +0,0 @@ -; RUN: llc -o /dev/null < %s -; PR7662 -; Do not add variables to !11 because it is a declaration entry. - -define i32 @bar() nounwind readnone ssp { -entry: - ret i32 42, !dbg !9 -} - -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!15} -!llvm.dbg.sp = !{!0, !6, !11} -!llvm.dbg.lv.foo = !{!7} - -!0 = distinct !DISubprogram(name: "bar", linkageName: "bar", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, file: !12, scope: !1, type: !3, function: i32 ()* @bar) -!1 = !DIFile(filename: "one.c", directory: "/private/tmp") -!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang 2.8", isOptimized: true, emissionKind: 0, file: !12, enums: !14, retainedTypes: !14, subprograms: !13) -!3 = !DISubroutineType(types: !4) -!4 = !{!5} -!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!6 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, file: !12, scope: !1, type: !3) -!7 = !DILocalVariable(name: "one", line: 8, scope: !8, file: !1, type: !5) -!8 = distinct !DILexicalBlock(line: 7, column: 18, file: !12, scope: !6) -!9 = !DILocation(line: 4, column: 3, scope: !10) -!10 = distinct !DILexicalBlock(line: 3, column: 11, file: !12, scope: !0) -!11 = !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: true, isDefinition: false, virtualIndex: 6, isOptimized: true, file: !12, scope: !1, type: !3) -!12 = !DIFile(filename: "one.c", directory: "/private/tmp") -!13 = !{!0} -!14 = !{} -!15 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/2010-10-01-crash.ll =================================================================== --- /dev/null +++ test/DebugInfo/2010-10-01-crash.ll @@ -1,24 +0,0 @@ -; RUN: llc -O0 %s -o /dev/null - -define void @CGRectStandardize(i32* sret %agg.result, i32* byval %rect) nounwind ssp { -entry: - call void @llvm.dbg.declare(metadata i32* %rect, metadata !23, metadata !DIExpression()), !dbg !24 - ret void -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind - - -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!27} -!0 = distinct !DISubprogram(name: "CGRectStandardize", linkageName: "CGRectStandardize", line: 54, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !1, scope: null, function: void (i32*, i32*)* @CGRectStandardize) -!1 = !DIFile(filename: "GSFusedSilica.m", directory: "/Volumes/Data/Users/sabre/Desktop") -!2 = distinct !DICompileUnit(language: DW_LANG_ObjC, producer: "clang version 2.9 (trunk 115292)", isOptimized: true, runtimeVersion: 1, emissionKind: 0, file: !25, enums: !26, retainedTypes: !26, subprograms: !{!0}) -!5 = !DIDerivedType(tag: DW_TAG_typedef, name: "CGRect", line: 49, file: !25, baseType: null) -!23 = !DILocalVariable(name: "rect", line: 53, arg: 2, scope: !0, file: !1, type: !5) -!24 = !DILocation(line: 53, column: 33, scope: !0) -!25 = !DIFile(filename: "GSFusedSilica.m", directory: "/Volumes/Data/Users/sabre/Desktop") -!26 = !{} -!27 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/Generic/lit.local.cfg =================================================================== --- /dev/null +++ test/DebugInfo/Generic/lit.local.cfg @@ -0,0 +1,2 @@ +if not config.target_triple: + config.unsupported = True Index: test/DebugInfo/PR20038.ll =================================================================== --- /dev/null +++ test/DebugInfo/PR20038.ll @@ -1,172 +0,0 @@ -; REQUIRES: object-emission - -; For some reason, the output when targetting sparc is not quite as expected. -; XFAIL: sparc - -; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=Enable < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; IR generated from clang -O0 with: -; struct C { -; ~C(); -; }; -; extern bool b; -; void fun4() { b && (C(), 1); } -; __attribute__((always_inline)) C::~C() { } - -; CHECK: DW_TAG_structure_type -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "C" -; CHECK-NOT: {{DW_TAG|NULL}} -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "~C" - -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_linkage_name {{.*}} "_ZN1CD1Ev" -; CHECK-NOT: {{DW_TAG|NULL}} -; CHECK: DW_TAG_formal_parameter -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "this" - -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "fun4" -; CHECK-NOT: {{DW_TAG|NULL}} -; CHECK: DW_TAG_inlined_subroutine -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev" -; CHECK-NOT: {{DW_TAG|NULL}} -; CHECK: DW_TAG_formal_parameter -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_abstract_origin {{.*}} "this" - -; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due -; to there being no work in D2 (calling another member function from the dtor -; causes D2 to show up, calling a free function doesn't). - -; CHECK-NOT: DW_TAG -; CHECK: NULL -; CHECK-NOT: DW_TAG -; CHECK: NULL - -%struct.C = type { i8 } - -@b = external global i8 - -; Function Attrs: nounwind -define void @_Z4fun4v() #0 { -entry: - %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21 - %this.addr.i = alloca %struct.C*, align 8, !dbg !22 - %agg.tmp.ensured = alloca %struct.C, align 1 - %cleanup.cond = alloca i1 - %0 = load i8, i8* @b, align 1, !dbg !24 - %tobool = trunc i8 %0 to i1, !dbg !24 - store i1 false, i1* %cleanup.cond - br i1 %tobool, label %land.rhs, label %land.end, !dbg !24 - -land.rhs: ; preds = %entry - store i1 true, i1* %cleanup.cond, !dbg !25 - br label %land.end - -land.end: ; preds = %land.rhs, %entry - %1 = phi i1 [ false, %entry ], [ true, %land.rhs ] - %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27 - br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27 - -cleanup.action: ; preds = %land.end - store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22 - call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !129, metadata !DIExpression()), !dbg !31 - %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22 - store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21 - call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !132, metadata !DIExpression()), !dbg !33 - %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21 - br label %cleanup.done, !dbg !22 - -cleanup.done: ; preds = %cleanup.action, %land.end - ret void, !dbg !34 -} - -; Function Attrs: alwaysinline nounwind -define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 { -entry: - %this.addr.i = alloca %struct.C*, align 8, !dbg !37 - %this.addr = alloca %struct.C*, align 8 - store %struct.C* %this, %struct.C** %this.addr, align 8 - call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !DIExpression()), !dbg !38 - %this1 = load %struct.C*, %struct.C** %this.addr - store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37 - call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !232, metadata !DIExpression()), !dbg !39 - %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37 - ret void, !dbg !37 -} - -; Function Attrs: alwaysinline nounwind -define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 { -entry: - %this.addr = alloca %struct.C*, align 8 - store %struct.C* %this, %struct.C** %this.addr, align 8 - call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !DIExpression()), !dbg !40 - %this1 = load %struct.C*, %struct.C** %this.addr - ret void, !dbg !41 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 - -attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { alwaysinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!18, !19} -!llvm.ident = !{!20} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !11, globals: !2, imports: !2) -!1 = !DIFile(filename: "", directory: "/tmp/dbginfo") -!2 = !{} -!3 = !{!4} -!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C") -!5 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo") -!6 = !{!7} -!7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1C", type: !8) -!8 = !DISubroutineType(types: !9) -!9 = !{null, !10} -!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1C") -!11 = !{!12, !16, !17} -!12 = distinct !DISubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !5, scope: !13, type: !14, function: void ()* @_Z4fun4v, variables: !2) -!13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo") -!14 = !DISubroutineType(types: !15) -!15 = !{null} -!16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, function: void (%struct.C*)* @_ZN1CD2Ev, declaration: !7, variables: !2) -!17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !5, scope: !"_ZTS1C", type: !8, function: void (%struct.C*)* @_ZN1CD1Ev, declaration: !7, variables: !2) -!18 = !{i32 2, !"Dwarf Version", i32 4} -!19 = !{i32 2, !"Debug Info Version", i32 3} -!20 = !{!"clang version 3.5.0 "} -!21 = !DILocation(line: 6, scope: !17, inlinedAt: !22) -!22 = !DILocation(line: 5, scope: !23) -!23 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) -!24 = !DILocation(line: 5, scope: !12) -!25 = !DILocation(line: 5, scope: !26) -!26 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) -!27 = !DILocation(line: 5, scope: !28) -!28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) -!29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30) -!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1C") -!31 = !DILocation(line: 0, scope: !17, inlinedAt: !22) -!32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) -!33 = !DILocation(line: 0, scope: !16, inlinedAt: !21) - -!129 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30) -!132 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) -!232 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30) - -!34 = !DILocation(line: 5, scope: !35) -!35 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !36) -!36 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12) -!37 = !DILocation(line: 6, scope: !17) -!38 = !DILocation(line: 0, scope: !17) -!39 = !DILocation(line: 0, scope: !16, inlinedAt: !37) -!40 = !DILocation(line: 0, scope: !16) -!41 = !DILocation(line: 6, scope: !16) Index: test/DebugInfo/accel-table-hash-collisions.ll =================================================================== --- /dev/null +++ test/DebugInfo/accel-table-hash-collisions.ll @@ -1,92 +0,0 @@ -; REQUIRES: object-emission -; RUN: %llc_dwarf -dwarf-accel-tables=Enable -filetype=obj -o - < %s | llvm-dwarfdump -debug-dump=apple_names - | FileCheck %s - -; Generated from the following C code using -; clang -S -emit-llvm hash-collision.c -; -; The names of the variables have been chosen so that they produce hash collisions. -; There are 12 names here that are hashed to only 6 hashes (each pair of lines -; hashes to the same value, see the CHECK lines below). -; -; int ForceTopDown; -; int _ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_; -; int _ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE; -; int _ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv; -; int _ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE; -; int _ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE; -; int k1; -; int is; -; int setStmt; -; int _ZN4llvm5TwineC1Ei; -; int _ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE; -; int _ZN4llvm22MachineModuleInfoMachOD2Ev; - -; Check that we have the right amount of hashes. -; CHECK: Bucket count = 6 -; CHECK: Hashes count = 6 - -; Check that all the names are present in the output -; CHECK: Hash = 0x00597841 -; CHECK: Name: {{[0-9a-f]*}} "is" -; CHECK: Name: {{[0-9a-f]*}} "k1" - -; CHECK: Hash = 0xa4b42a1e -; CHECK: Name: {{[0-9a-f]*}} "_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE" -; CHECK: Name: {{[0-9a-f]*}} "_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv" - -; CHECK: Hash = 0xeee7c0b2 -; CHECK: Name: {{[0-9a-f]*}} "_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE" -; CHECK: Name: {{[0-9a-f]*}} "_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE" - -; CHECK: Hash = 0xea48ac5f -; CHECK: Name: {{[0-9a-f]*}} "ForceTopDown" -; CHECK: Name: {{[0-9a-f]*}} "_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_" - -; CHECK: Hash = 0x6b22f71f -; CHECK: Name: {{[0-9a-f]*}} "_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE" -; CHECK: Name: {{[0-9a-f]*}} "_ZN4llvm22MachineModuleInfoMachOD2Ev" - -; CHECK: Hash = 0x8c248979 -; CHECK: Name: {{[0-9a-f]*}} "setStmt" -; CHECK: Name: {{[0-9a-f]*}} "_ZN4llvm5TwineC1Ei" - - - -@ForceTopDown = common global i32 0, align 4 -@_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_ = common global i32 0, align 4 -@_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE = common global i32 0, align 4 -@_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv = common global i32 0, align 4 -@_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE = common global i32 0, align 4 -@_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE = common global i32 0, align 4 -@k1 = common global i32 0, align 4 -@is = common global i32 0, align 4 -@setStmt = common global i32 0, align 4 -@_ZN4llvm5TwineC1Ei = common global i32 0, align 4 -@_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE = common global i32 0, align 4 -@_ZN4llvm22MachineModuleInfoMachOD2Ev = common global i32 0, align 4 - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!17, !18, !19} -!llvm.ident = !{!20} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 231548) (llvm/trunk 231547)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !3, imports: !2) -!1 = !DIFile(filename: "hash-collisions.c", directory: "/tmp") -!2 = !{} -!3 = !{!4, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16} -!4 = !DIGlobalVariable(name: "ForceTopDown", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @ForceTopDown) -!5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!6 = !DIGlobalVariable(name: "_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_", scope: !0, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZNSt3__116allocator_traitsINS_9allocatorINS_11__tree_nodeINS_12__value_typeIPN4llvm10BasicBlockEPNS4_10RegionNodeEEEPvEEEEE11__constructIS9_JNS_4pairIS6_S8_EEEEEvNS_17integral_constantIbLb1EEERSC_PT_DpOT0_) -!7 = !DIGlobalVariable(name: "_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE", scope: !0, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN5clang23DataRecursiveASTVisitorIN12_GLOBAL__N_124UnusedBackingIvarCheckerEE26TraverseCUDAKernelCallExprEPNS_18CUDAKernelCallExprE) -!8 = !DIGlobalVariable(name: "_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv", scope: !0, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm16DenseMapIteratorIPNS_10MDLocationENS_6detail13DenseSetEmptyENS_10MDNodeInfoIS1_EENS3_12DenseSetPairIS2_EELb0EE23AdvancePastEmptyBucketsEv) -!9 = !DIGlobalVariable(name: "_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE", scope: !0, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZNK4llvm12LivePhysRegs5printERNS_11raw_ostreamE) -!10 = !DIGlobalVariable(name: "_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE", scope: !0, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm15ScalarEvolution14getSignedRangeEPKNS_4SCEVE) -!11 = !DIGlobalVariable(name: "k1", scope: !0, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, variable: i32* @k1) -!12 = !DIGlobalVariable(name: "is", scope: !0, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, variable: i32* @is) -!13 = !DIGlobalVariable(name: "setStmt", scope: !0, file: !1, line: 9, type: !5, isLocal: false, isDefinition: true, variable: i32* @setStmt) -!14 = !DIGlobalVariable(name: "_ZN4llvm5TwineC1Ei", scope: !0, file: !1, line: 10, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm5TwineC1Ei) -!15 = !DIGlobalVariable(name: "_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE", scope: !0, file: !1, line: 11, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZNK5clang12OverrideAttr5cloneERNS_10ASTContextE) -!16 = !DIGlobalVariable(name: "_ZN4llvm22MachineModuleInfoMachOD2Ev", scope: !0, file: !1, line: 12, type: !5, isLocal: false, isDefinition: true, variable: i32* @_ZN4llvm22MachineModuleInfoMachOD2Ev) -!17 = !{i32 2, !"Dwarf Version", i32 2} -!18 = !{i32 2, !"Debug Info Version", i32 3} -!19 = !{i32 1, !"PIC Level", i32 2} -!20 = !{!"clang version 3.7.0 (trunk 231548) (llvm/trunk 231547)"} Index: test/DebugInfo/array.ll =================================================================== --- /dev/null +++ test/DebugInfo/array.ll @@ -1,40 +0,0 @@ -; RUN: %llc_dwarf -O0 < %s | FileCheck %s -; Do not emit AT_upper_bound for an unbounded array. -; radar 9241695 -define i32 @main() nounwind ssp { -entry: - %retval = alloca i32, align 4 - %a = alloca [0 x i32], align 4 - store i32 0, i32* %retval - call void @llvm.dbg.declare(metadata [0 x i32]* %a, metadata !6, metadata !DIExpression()), !dbg !11 - ret i32 0, !dbg !12 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!16} - -!0 = distinct !DISubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 3, file: !14, scope: !1, type: !3, function: i32 ()* @main) -!1 = !DIFile(filename: "array.c", directory: "/private/tmp") -!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 129138)", isOptimized: false, emissionKind: 0, file: !14, enums: !15, retainedTypes: !15, subprograms: !13, imports: null) -!3 = !DISubroutineType(types: !4) -!4 = !{!5} -!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!6 = !DILocalVariable(name: "a", line: 4, scope: !7, file: !1, type: !8) -!7 = distinct !DILexicalBlock(line: 3, column: 12, file: !14, scope: !0) -!8 = !DICompositeType(tag: DW_TAG_array_type, align: 32, file: !14, scope: !2, baseType: !5, elements: !9) -!9 = !{!10} -;CHECK: section_info: -;CHECK: DW_TAG_subrange_type -;CHECK-NEXT: DW_AT_type -;CHECK-NOT: DW_AT_lower_bound -;CHECK-NOT: DW_AT_upper_bound -;CHECK-NEXT: End Of Children Mark -!10 = !DISubrange(count: -1) -!11 = !DILocation(line: 4, column: 7, scope: !7) -!12 = !DILocation(line: 5, column: 3, scope: !7) -!13 = !{!0} -!14 = !DIFile(filename: "array.c", directory: "/private/tmp") -!15 = !{} -!16 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/block-asan.ll =================================================================== --- /dev/null +++ test/DebugInfo/block-asan.ll @@ -1,87 +0,0 @@ -; RUN: opt -S -asan %s | FileCheck %s - -; The IR of this testcase is generated from the following C code: -; void bar (int); -; -; void foo() { -; __block int x; -; bar(x); -; } -; by compiling it with 'clang -emit-llvm -g -S' and then by manually -; adding the sanitize_address attribute to the @foo() function (so -; that ASAN accepts to instrument the function in the above opt run). - -; Check that the location of the ASAN instrumented __block variable is -; correct. -; CHECK: !DIExpression(DW_OP_deref, DW_OP_plus, 8, DW_OP_deref, DW_OP_plus, 24) - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" - -%struct.__block_byref_x = type { i8*, %struct.__block_byref_x*, i32, i32, i32 } - -; Function Attrs: nounwind ssp uwtable -define void @foo() #0 { -entry: - %x = alloca %struct.__block_byref_x, align 8 - call void @llvm.dbg.declare(metadata %struct.__block_byref_x* %x, metadata !12, metadata !22), !dbg !23 - %byref.isa = getelementptr inbounds %struct.__block_byref_x, %struct.__block_byref_x* %x, i32 0, i32 0, !dbg !24 - store i8* null, i8** %byref.isa, !dbg !24 - %byref.forwarding = getelementptr inbounds %struct.__block_byref_x, %struct.__block_byref_x* %x, i32 0, i32 1, !dbg !24 - store %struct.__block_byref_x* %x, %struct.__block_byref_x** %byref.forwarding, !dbg !24 - %byref.flags = getelementptr inbounds %struct.__block_byref_x, %struct.__block_byref_x* %x, i32 0, i32 2, !dbg !24 - store i32 0, i32* %byref.flags, !dbg !24 - %byref.size = getelementptr inbounds %struct.__block_byref_x, %struct.__block_byref_x* %x, i32 0, i32 3, !dbg !24 - store i32 32, i32* %byref.size, !dbg !24 - %forwarding = getelementptr inbounds %struct.__block_byref_x, %struct.__block_byref_x* %x, i32 0, i32 1, !dbg !25 - %0 = load %struct.__block_byref_x*, %struct.__block_byref_x** %forwarding, !dbg !25 - %x1 = getelementptr inbounds %struct.__block_byref_x, %struct.__block_byref_x* %0, i32 0, i32 4, !dbg !25 - %1 = load i32, i32* %x1, align 4, !dbg !25 - call void @bar(i32 %1), !dbg !25 - %2 = bitcast %struct.__block_byref_x* %x to i8*, !dbg !26 - call void @_Block_object_dispose(i8* %2, i32 8) #3, !dbg !26 - ret void, !dbg !26 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -declare void @bar(i32) #2 - -declare void @_Block_object_dispose(i8*, i32) - -attributes #0 = { nounwind ssp uwtable sanitize_address "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 } -attributes #2 = { "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 #3 = { nounwind } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!8, !9, !10} -!llvm.ident = !{!11} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 (trunk 223120) (llvm/trunk 223119)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) -!1 = !DIFile(filename: "block.c", directory: "/tmp") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: true, isOptimized: false, scopeLine: 3, file: !1, scope: !5, type: !6, function: void ()* @foo, variables: !2) -!5 = !DIFile(filename: "block.c", directory: "/tmp") -!6 = !DISubroutineType(types: !7) -!7 = !{null} -!8 = !{i32 2, !"Dwarf Version", i32 2} -!9 = !{i32 2, !"Debug Info Version", i32 3} -!10 = !{i32 1, !"PIC Level", i32 2} -!11 = !{!"clang version 3.6.0 (trunk 223120) (llvm/trunk 223119)"} -!12 = !DILocalVariable(name: "x", line: 4, scope: !4, file: !5, type: !13) -!13 = !DICompositeType(tag: DW_TAG_structure_type, size: 224, flags: DIFlagBlockByrefStruct, file: !1, scope: !5, elements: !14) -!14 = !{!15, !17, !18, !20, !21} -!15 = !DIDerivedType(tag: DW_TAG_member, name: "__isa", size: 64, align: 64, file: !1, scope: !5, baseType: !16) -!16 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: null) -!17 = !DIDerivedType(tag: DW_TAG_member, name: "__forwarding", size: 64, align: 64, offset: 64, file: !1, scope: !5, baseType: !16) -!18 = !DIDerivedType(tag: DW_TAG_member, name: "__flags", size: 32, align: 32, offset: 128, file: !1, scope: !5, baseType: !19) -!19 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!20 = !DIDerivedType(tag: DW_TAG_member, name: "__size", size: 32, align: 32, offset: 160, file: !1, scope: !5, baseType: !19) -!21 = !DIDerivedType(tag: DW_TAG_member, name: "x", size: 32, align: 32, offset: 192, file: !1, scope: !5, baseType: !19) -!22 = !DIExpression(DW_OP_plus, 8, DW_OP_deref, DW_OP_plus, 24) -!23 = !DILocation(line: 4, column: 15, scope: !4) -!24 = !DILocation(line: 4, column: 3, scope: !4) -!25 = !DILocation(line: 5, column: 3, scope: !4) -!26 = !DILocation(line: 6, column: 1, scope: !4) Index: test/DebugInfo/bug_null_debuginfo.ll =================================================================== --- /dev/null +++ test/DebugInfo/bug_null_debuginfo.ll @@ -1,8 +0,0 @@ -; RUN: llc < %s - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!2} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, isOptimized: false, emissionKind: 0, file: !1, globals: null) -!1 = !DIFile(filename: "t", directory: "") -!2 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/constant-pointers.ll =================================================================== --- /dev/null +++ test/DebugInfo/constant-pointers.ll @@ -1,51 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; Ensure that pointer constants are emitted as unsigned data. Alternatively, -; these could be signless data (dataN). - -; Built with Clang from: -; template -; void func() {} -; template void func(); - -; CHECK: DW_TAG_subprogram -; CHECK: DW_TAG_template_value_parameter -; CHECK: DW_AT_name {{.*}} "V" -; CHECK: DW_AT_const_value [DW_FORM_udata] (0) -; CHECK: DW_TAG_template_value_parameter -; CHECK: DW_AT_name {{.*}} "F" -; CHECK: DW_AT_const_value [DW_FORM_udata] (0) - -; Function Attrs: nounwind uwtable -define weak_odr void @_Z4funcILPv0ELPFvvE0ELi42EEvv() #0 { -entry: - ret void, !dbg !18 -} - -attributes #0 = { nounwind 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" } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!15, !16} -!llvm.ident = !{!17} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) -!1 = !DIFile(filename: "constant-pointers.cpp", directory: "/tmp/dbginfo") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcILPv0ELPFvvE0ELi42EEvv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !5, type: !6, function: void ()* @_Z4funcILPv0ELPFvvE0ELi42EEvv, templateParams: !8, variables: !2) -!5 = !DIFile(filename: "constant-pointers.cpp", directory: "/tmp/dbginfo") -!6 = !DISubroutineType(types: !7) -!7 = !{null} -!8 = !{!9, !11, !13} -!9 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "V", type: !10, value: i8 0) -!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: null) -!11 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "F", type: !12, value: i8 0) -!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !6) -!13 = !DITemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "i", type: !14, value: i32 42) -!14 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!15 = !{i32 2, !"Dwarf Version", i32 4} -!16 = !{i32 2, !"Debug Info Version", i32 3} -!17 = !{!"clang version 3.5.0 "} -!18 = !DILocation(line: 3, scope: !4) Index: test/DebugInfo/constant-sdnodes-have-dbg-location.ll =================================================================== --- /dev/null +++ test/DebugInfo/constant-sdnodes-have-dbg-location.ll @@ -1,26 +0,0 @@ -; RUN: llc -debug < %s 2>&1 | FileCheck %s -; REQUIRES: asserts - -; CHECK: 0x{{[0-9,a-f]+}}: i32 = Constant<-1>test.c:4:5 - -define i32 @main() { -entry: - %retval = alloca i32, align 4 - store i32 0, i32* %retval - ret i32 -1, !dbg !10 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!8, !9} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, subprograms: !3) -!1 = !DIFile(filename: "test.c", directory: "/home/user/clang-llvm/build") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, function: i32 ()* @main, variables: !2) -!5 = !DISubroutineType(types: !6) -!6 = !{!7} -!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!8 = !{i32 2, !"Dwarf Version", i32 4} -!9 = !{i32 2, !"Debug Info Version", i32 3} -!10 = !DILocation(line: 4, column: 5, scope: !4) Index: test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll =================================================================== --- /dev/null +++ test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll @@ -1,24 +0,0 @@ -; RUN: llc -debug < %s 2>&1 | FileCheck %s -; REQUIRES: asserts - -; CHECK: 0x{{[0-9,a-f]+}}: f64 = ConstantFP<1.500000e+00>test.c:3:5 - -define double @f() { -entry: - ret double 1.500000e+00, !dbg !10 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!8, !9} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, subprograms: !3) -!1 = !DIFile(filename: "test.c", directory: "/home/user/clang-llvm/build") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, function: double ()* @f, variables: !2) -!5 = !DISubroutineType(types: !6) -!6 = !{!7} -!7 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float) -!8 = !{i32 2, !"Dwarf Version", i32 4} -!9 = !{i32 2, !"Debug Info Version", i32 3} -!10 = !DILocation(line: 3, column: 5, scope: !4) Index: test/DebugInfo/cross-cu-inlining.ll =================================================================== --- /dev/null +++ test/DebugInfo/cross-cu-inlining.ll @@ -1,143 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=Enable < %s | llvm-dwarfdump -debug-dump=info - | FileCheck -implicit-check-not=DW_TAG %s -; RUN: %llc_dwarf -dwarf-accel-tables=Enable -dwarf-linkage-names=Enable -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck --check-prefix=CHECK-ACCEL --check-prefix=CHECK %s - -; Build from source: -; $ clang++ a.cpp b.cpp -g -c -emit-llvm -; $ llvm-link a.bc b.bc -o ab.bc -; $ opt -inline ab.bc -o ab-opt.bc -; $ cat a.cpp -; extern int i; -; int func(int); -; int main() { -; return func(i); -; } -; $ cat b.cpp -; int __attribute__((always_inline)) func(int x) { -; return x * 2; -; } - -; Ensure that func inlined into main is described and references the abstract -; definition in b.cpp's CU. - -; CHECK: DW_TAG_compile_unit -; CHECK: DW_AT_name {{.*}} "a.cpp" -; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000[[INT:.*]]) -; CHECK: 0x[[INLINED:[0-9a-f]*]]:{{.*}}DW_TAG_inlined_subroutine -; CHECK: DW_AT_abstract_origin {{.*}}[[ABS_FUNC:........]] "_Z4funci" -; CHECK: DW_TAG_formal_parameter -; CHECK: DW_AT_abstract_origin {{.*}}[[ABS_VAR:........]] "x" - -; Check the abstract definition is in the 'b.cpp' CU and doesn't contain any -; concrete information (address range or variable location) -; CHECK: DW_TAG_compile_unit -; CHECK: DW_AT_name {{.*}} "b.cpp" -; CHECK: 0x[[ABS_FUNC]]: DW_TAG_subprogram -; CHECK-NOT: DW_AT_low_pc -; CHECK: 0x[[ABS_VAR]]: DW_TAG_formal_parameter -; CHECK-NOT: DW_AT_location -; CHECK: DW_AT_type [DW_FORM_ref4] {{.*}} {0x[[INT]]} -; CHECK-NOT: DW_AT_location - -; CHECK: 0x[[INT]]: DW_TAG_base_type -; CHECK: DW_AT_name {{.*}} "int" - -; Check the concrete out of line definition references the abstract and -; provides the address range and variable location -; CHECK: 0x[[FUNC:[0-9a-f]*]]{{.*}}DW_TAG_subprogram -; CHECK: DW_AT_low_pc -; CHECK: DW_AT_abstract_origin {{.*}} {0x[[ABS_FUNC]]} "_Z4funci" -; CHECK: DW_TAG_formal_parameter -; CHECK: DW_AT_location -; CHECK: DW_AT_abstract_origin {{.*}} {0x[[ABS_VAR]]} "x" - -; Check that both the inline and the non out of line version of func are -; correctly referenced in the accelerator table. Before r221837, the one -; in the second compilation unit had a wrong offset -; CHECK-ACCEL: .apple_names contents: -; CHECK-ACCEL: Name{{.*}}"func" -; CHECK-ACCEL-NOT: Name -; CHECK-ACCEL: Atom[0]{{.*}}[[INLINED]] -; CHECK-ACCEL-NOT: Name -; CHECK-ACCEL: Atom[0]{{.*}}[[FUNC]] - -@i = external global i32 - -; Function Attrs: uwtable -define i32 @main() #0 { -entry: - %x.addr.i = alloca i32, align 4 - %retval = alloca i32, align 4 - store i32 0, i32* %retval - %0 = load i32, i32* @i, align 4, !dbg !19 - %1 = bitcast i32* %x.addr.i to i8* - call void @llvm.lifetime.start(i64 4, i8* %1) - store i32 %0, i32* %x.addr.i, align 4 - call void @llvm.dbg.declare(metadata i32* %x.addr.i, metadata !120, metadata !DIExpression()), !dbg !21 - %2 = load i32, i32* %x.addr.i, align 4, !dbg !22 - %mul.i = mul nsw i32 %2, 2, !dbg !22 - %3 = bitcast i32* %x.addr.i to i8*, !dbg !22 - call void @llvm.lifetime.end(i64 4, i8* %3), !dbg !22 - ret i32 %mul.i, !dbg !19 -} - -; Function Attrs: alwaysinline nounwind uwtable -define i32 @_Z4funci(i32 %x) #1 { -entry: - %x.addr = alloca i32, align 4 - store i32 %x, i32* %x.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !20, metadata !DIExpression()), !dbg !23 - %0 = load i32, i32* %x.addr, align 4, !dbg !24 - %mul = mul nsw i32 %0, 2, !dbg !24 - ret i32 %mul, !dbg !24 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 - -; Function Attrs: nounwind -declare void @llvm.lifetime.start(i64, i8* nocapture) #3 - -; Function Attrs: nounwind -declare void @llvm.lifetime.end(i64, i8* nocapture) #3 - -attributes #0 = { 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 = { alwaysinline nounwind 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 #2 = { nounwind readnone } -attributes #3 = { nounwind } - -!llvm.dbg.cu = !{!0, !9} -!llvm.module.flags = !{!16, !17} -!llvm.ident = !{!18, !18} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) -!1 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !5, type: !6, function: i32 ()* @main, variables: !2) -!5 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo") -!6 = !DISubroutineType(types: !7) -!7 = !{!8} -!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!9 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !10, enums: !2, retainedTypes: !2, subprograms: !11, globals: !2, imports: !2) -!10 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo") -!11 = !{!12} -!12 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !10, scope: !13, type: !14, function: i32 (i32)* @_Z4funci, variables: !2) -!13 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo") -!14 = !DISubroutineType(types: !15) -!15 = !{!8, !8} -!16 = !{i32 2, !"Dwarf Version", i32 4} -!17 = !{i32 2, !"Debug Info Version", i32 3} -!18 = !{!"clang version 3.5.0 "} -!19 = !DILocation(line: 4, scope: !4) -!20 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !12, file: !13, type: !8) - -!120 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !12, file: !13, type: !8) - -!21 = !DILocation(line: 1, scope: !12, inlinedAt: !19) -!22 = !DILocation(line: 2, scope: !12, inlinedAt: !19) -!23 = !DILocation(line: 1, scope: !12) -!24 = !DILocation(line: 2, scope: !12) - Index: test/DebugInfo/cross-cu-linkonce-distinct.ll =================================================================== --- /dev/null +++ test/DebugInfo/cross-cu-linkonce-distinct.ll @@ -1,95 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; Testing that two distinct (distinct by writing them in separate files, while -; still fulfilling C++'s ODR by having identical token sequences) functions, -; linked under LTO, get plausible debug info (and don't crash). - -; Built from source: -; $ clang++ a.cpp b.cpp -g -c -emit-llvm -; $ llvm-link a.bc b.bc -o ab.bc - -; This change is intended to tickle a case where the subprogram MDNode -; associated with the llvm::Function will differ from the subprogram -; referenced by the DbgLocs in the function. - -; $ sed -ie "s/!12, !0/!0, !12/" ab.ll -; $ cat a.cpp -; inline int func(int i) { -; return i * 2; -; } -; int (*x)(int) = &func; -; $ cat b.cpp -; inline int func(int i) { -; return i * 2; -; } -; int (*y)(int) = &func; - -; CHECK: DW_TAG_compile_unit -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "func" -; CHECK: DW_TAG_compile_unit - -; FIXME: Maybe we should drop the subprogram here - since the function was -; emitted in one CU, due to linkonce_odr uniquing. We certainly don't emit the -; subprogram here if the source location for this definition is the same (see -; test/DebugInfo/cross-cu-linkonce.ll), though it's very easy to tickle that -; into failing even without duplicating the source as has been done in this -; case (two cpp files in different directories, including the same header that -; contains an inline function - clang will produce distinct subprogram metadata -; that won't deduplicate owing to the file location information containing the -; directory of the source file even though the file name is absolute, not -; relative) - -; CHECK: DW_TAG_subprogram - -@x = global i32 (i32)* @_Z4funci, align 8 -@y = global i32 (i32)* @_Z4funci, align 8 - -; Function Attrs: inlinehint nounwind uwtable -define linkonce_odr i32 @_Z4funci(i32 %i) #0 { - %1 = alloca i32, align 4 - store i32 %i, i32* %1, align 4 - call void @llvm.dbg.declare(metadata i32* %1, metadata !22, metadata !DIExpression()), !dbg !23 - %2 = load i32, i32* %1, align 4, !dbg !24 - %3 = mul nsw i32 %2, 2, !dbg !24 - ret i32 %3, !dbg !24 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -attributes #0 = { inlinehint nounwind 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 = !{!12, !0} -!llvm.module.flags = !{!19, !20} -!llvm.ident = !{!21, !21} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !9, imports: !2) -!1 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, function: i32 (i32)* @_Z4funci, variables: !2) -!5 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo") -!6 = !DISubroutineType(types: !7) -!7 = !{!8, !8} -!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!9 = !{!10} -!10 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !5, type: !11, variable: i32 (i32)** @x) -!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !6) -!12 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !13, enums: !2, retainedTypes: !2, subprograms: !14, globals: !17, imports: !2) -!13 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo") -!14 = !{!15} -!15 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !13, scope: !16, type: !6, function: i32 (i32)* @_Z4funci, variables: !2) -!16 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo") -!17 = !{!18} -!18 = !DIGlobalVariable(name: "y", line: 4, isLocal: false, isDefinition: true, scope: null, file: !16, type: !11, variable: i32 (i32)** @y) -!19 = !{i32 2, !"Dwarf Version", i32 4} -!20 = !{i32 1, !"Debug Info Version", i32 3} -!21 = !{!"clang version 3.5.0 "} -!22 = !DILocalVariable(name: "i", line: 1, arg: 1, scope: !4, file: !5, type: !8) -!23 = !DILocation(line: 1, scope: !4) -!24 = !DILocation(line: 2, scope: !4) Index: test/DebugInfo/cross-cu-linkonce.ll =================================================================== --- /dev/null +++ test/DebugInfo/cross-cu-linkonce.ll @@ -1,73 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; Built from source: -; $ clang++ a.cpp b.cpp -g -c -emit-llvm -; $ llvm-link a.bc b.bc -o ab.bc -; $ cat a.cpp -; # 1 "func.h" -; inline int func(int i) { -; return i * 2; -; } -; int (*x)(int) = &func; -; $ cat b.cpp -; # 1 "func.h" -; inline int func(int i) { -; return i * 2; -; } -; int (*y)(int) = &func; - -; CHECK: DW_TAG_compile_unit -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "func" -; CHECK: DW_TAG_compile_unit -; CHECK-NOT: DW_TAG_subprogram - -@x = global i32 (i32)* @_Z4funci, align 8 -@y = global i32 (i32)* @_Z4funci, align 8 - -; Function Attrs: inlinehint nounwind uwtable -define linkonce_odr i32 @_Z4funci(i32 %i) #0 { - %1 = alloca i32, align 4 - store i32 %i, i32* %1, align 4 - call void @llvm.dbg.declare(metadata i32* %1, metadata !20, metadata !DIExpression()), !dbg !21 - %2 = load i32, i32* %1, align 4, !dbg !22 - %3 = mul nsw i32 %2, 2, !dbg !22 - ret i32 %3, !dbg !22 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -attributes #0 = { inlinehint nounwind 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, !13} -!llvm.module.flags = !{!17, !18} -!llvm.ident = !{!19, !19} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !10, imports: !2) -!1 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !5, scope: !6, type: !7, function: i32 (i32)* @_Z4funci, variables: !2) -!5 = !DIFile(filename: "func.h", directory: "/tmp/dbginfo") -!6 = !DIFile(filename: "func.h", directory: "/tmp/dbginfo") -!7 = !DISubroutineType(types: !8) -!8 = !{!9, !9} -!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!10 = !{!11} -!11 = !DIGlobalVariable(name: "x", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12, variable: i32 (i32)** @x) -!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !7) -!13 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !14, enums: !2, retainedTypes: !2, subprograms: !3, globals: !15, imports: !2) -!14 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo") -!15 = !{!16} -!16 = !DIGlobalVariable(name: "y", line: 4, isLocal: false, isDefinition: true, scope: null, file: !6, type: !12, variable: i32 (i32)** @y) -!17 = !{i32 2, !"Dwarf Version", i32 4} -!18 = !{i32 1, !"Debug Info Version", i32 3} -!19 = !{!"clang version 3.5.0 "} -!20 = !DILocalVariable(name: "i", line: 1, arg: 1, scope: !4, file: !6, type: !9) -!21 = !DILocation(line: 1, scope: !4) -!22 = !DILocation(line: 2, scope: !4) Index: test/DebugInfo/cu-range-hole.ll =================================================================== --- /dev/null +++ test/DebugInfo/cu-range-hole.ll @@ -1,74 +0,0 @@ -; REQUIRES: object-emission -; RUN: %llc_dwarf -O0 -filetype=obj %s -o %t -; RUN: llvm-dwarfdump %t | FileCheck %s - -; Check that we emit ranges for this CU since we have a function with and -; without debug info. -; Note: This depends upon the order of output in the .o file. Currently it's -; in order of the output to make sure that the CU has multiple ranges since -; there's a function in the middle. If they were together then it would have -; a single range and no DW_AT_ranges. -; CHECK: DW_TAG_compile_unit -; CHECK: DW_AT_ranges -; CHECK: DW_TAG_subprogram -; CHECK: DW_TAG_subprogram - -; Function Attrs: nounwind uwtable -define i32 @b(i32 %c) #0 { -entry: - %c.addr = alloca i32, align 4 - store i32 %c, i32* %c.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %c.addr, metadata !13, metadata !DIExpression()), !dbg !14 - %0 = load i32, i32* %c.addr, align 4, !dbg !14 - %add = add nsw i32 %0, 1, !dbg !14 - ret i32 %add, !dbg !14 -} - -; Function Attrs: nounwind uwtable -define i32 @a(i32 %b) #0 { -entry: - %b.addr = alloca i32, align 4 - store i32 %b, i32* %b.addr, align 4 - %0 = load i32, i32* %b.addr, align 4 - %add = add nsw i32 %0, 1 - ret i32 %add -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -; Function Attrs: nounwind uwtable -define i32 @d(i32 %e) #0 { -entry: - %e.addr = alloca i32, align 4 - store i32 %e, i32* %e.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %e.addr, metadata !15, metadata !DIExpression()), !dbg !16 - %0 = load i32, i32* %e.addr, align 4, !dbg !16 - %add = add nsw i32 %0, 1, !dbg !16 - ret i32 %add, !dbg !16 -} - -attributes #0 = { nounwind 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.ident = !{!0, !0} -!llvm.dbg.cu = !{!1} -!llvm.module.flags = !{!11, !12} - -!0 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"} -!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", isOptimized: false, emissionKind: 1, file: !2, enums: !3, retainedTypes: !3, subprograms: !4, globals: !3, imports: !3) -!2 = !DIFile(filename: "b.c", directory: "/usr/local/google/home/echristo") -!3 = !{} -!4 = !{!5, !10} -!5 = distinct !DISubprogram(name: "b", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !2, scope: !6, type: !7, function: i32 (i32)* @b, variables: !3) -!6 = !DIFile(filename: "b.c", directory: "/usr/local/google/home/echristo") -!7 = !DISubroutineType(types: !8) -!8 = !{!9, !9} -!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!10 = distinct !DISubprogram(name: "d", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !2, scope: !6, type: !7, function: i32 (i32)* @d, variables: !3) -!11 = !{i32 2, !"Dwarf Version", i32 4} -!12 = !{i32 1, !"Debug Info Version", i32 3} -!13 = !DILocalVariable(name: "c", line: 1, arg: 1, scope: !5, file: !6, type: !9) -!14 = !DILocation(line: 1, scope: !5) -!15 = !DILocalVariable(name: "e", line: 3, arg: 1, scope: !10, file: !6, type: !9) -!16 = !DILocation(line: 3, scope: !10) Index: test/DebugInfo/cu-ranges.ll =================================================================== --- /dev/null +++ test/DebugInfo/cu-ranges.ll @@ -1,71 +0,0 @@ -; REQUIRES: object-emission -; RUN: %llc_dwarf -O0 -filetype=obj %s -o %t -; RUN: llvm-dwarfdump %t | FileCheck %s - -; Check that we emit ranges for this which has a non-traditional section and a normal section. - -; CHECK: DW_TAG_compile_unit -; CHECK: DW_AT_ranges -; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_low_pc -; CHECK: DW_AT_high_pc -; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_low_pc -; CHECK: DW_AT_high_pc - -; CHECK: .debug_ranges contents: -; FIXME: When we get better dumping facilities we'll want to elaborate here. -; CHECK: 00000000 - -; Function Attrs: nounwind uwtable -define i32 @foo(i32 %a) #0 section "__TEXT,__foo" { -entry: - %a.addr = alloca i32, align 4 - store i32 %a, i32* %a.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !13, metadata !DIExpression()), !dbg !14 - %0 = load i32, i32* %a.addr, align 4, !dbg !15 - %add = add nsw i32 %0, 5, !dbg !15 - ret i32 %add, !dbg !15 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -; Function Attrs: nounwind uwtable -define i32 @bar(i32 %a) #0 { -entry: - %a.addr = alloca i32, align 4 - store i32 %a, i32* %a.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !16, metadata !DIExpression()), !dbg !17 - %0 = load i32, i32* %a.addr, align 4, !dbg !18 - %add = add nsw i32 %0, 5, !dbg !18 - ret i32 %add, !dbg !18 -} - -attributes #0 = { nounwind 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 = !{!10, !11} -!llvm.ident = !{!12} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) -!1 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo") -!2 = !{} -!3 = !{!4, !9} -!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, function: i32 (i32)* @foo, variables: !2) -!5 = !DIFile(filename: "foo.c", directory: "/usr/local/google/home/echristo") -!6 = !DISubroutineType(types: !7) -!7 = !{!8, !8} -!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!9 = distinct !DISubprogram(name: "bar", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !5, type: !6, function: i32 (i32)* @bar, variables: !2) -!10 = !{i32 2, !"Dwarf Version", i32 4} -!11 = !{i32 1, !"Debug Info Version", i32 3} -!12 = !{!"clang version 3.5.0 (trunk 204164) (llvm/trunk 204183)"} -!13 = !DILocalVariable(name: "a", line: 1, arg: 1, scope: !4, file: !5, type: !8) -!14 = !DILocation(line: 1, scope: !4) -!15 = !DILocation(line: 2, scope: !4) -!16 = !DILocalVariable(name: "a", line: 5, arg: 1, scope: !9, file: !5, type: !8) -!17 = !DILocation(line: 5, scope: !9) -!18 = !DILocation(line: 6, scope: !9) - Index: test/DebugInfo/dead-argument-order.ll =================================================================== --- /dev/null +++ test/DebugInfo/dead-argument-order.ll @@ -1,81 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; Built from the following source with clang -O1 -; struct S { int i; }; -; int function(struct S s, int i) { return s.i + i; } - -; Due to the X86_64 ABI, 's' is passed in registers and once optimized, the -; entirety of 's' is never reconstituted, since only the int is required, and -; thus the variable's location is unknown/dead to debug info. - -; Future/current work should enable us to describe partial variables, which, in -; this case, happens to be the entire variable. - -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "function" -; CHECK-NOT: {{DW_TAG|NULL}} -; CHECK: DW_TAG_formal_parameter -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "s" -; CHECK-NOT: DW_TAG -; FIXME: Even though 's' is never reconstituted into a struct, the one member -; variable is still live and used, and so we should be able to describe 's's -; location as the location of that int. -; CHECK-NOT: DW_AT_location -; CHECK-NOT: {{DW_TAG|NULL}} -; CHECK: DW_TAG_formal_parameter -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_location -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "i" - - -%struct.S = type { i32 } - -; Function Attrs: nounwind readnone uwtable -define i32 @_Z8function1Si(i32 %s.coerce, i32 %i) #0 { -entry: - tail call void @llvm.dbg.declare(metadata %struct.S* undef, metadata !14, metadata !DIExpression()), !dbg !20 - tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !15, metadata !DIExpression()), !dbg !20 - %add = add nsw i32 %i, %s.coerce, !dbg !20 - ret i32 %add, !dbg !20 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 - -attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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 = !{!16, !17} -!llvm.ident = !{!18} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !8, globals: !2, imports: !2) -!1 = !DIFile(filename: "dead-argument-order.cpp", directory: "/tmp/dbginfo") -!2 = !{} -!3 = !{!4} -!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 1, size: 32, align: 32, file: !1, elements: !5, identifier: "_ZTS1S") -!5 = !{!6} -!6 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 1, size: 32, align: 32, file: !1, scope: !"_ZTS1S", baseType: !7) -!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!8 = !{!9} -!9 = distinct !DISubprogram(name: "function", linkageName: "_Z8function1Si", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !1, scope: !10, type: !11, function: i32 (i32, i32)* @_Z8function1Si, variables: !13) -!10 = !DIFile(filename: "dead-argument-order.cpp", directory: "/tmp/dbginfo") -!11 = !DISubroutineType(types: !12) -!12 = !{!7, !4, !7} -!13 = !{!14, !15} -!14 = !DILocalVariable(name: "s", line: 2, arg: 1, scope: !9, file: !10, type: !"_ZTS1S") -!15 = !DILocalVariable(name: "i", line: 2, arg: 2, scope: !9, file: !10, type: !7) -!16 = !{i32 2, !"Dwarf Version", i32 4} -!17 = !{i32 2, !"Debug Info Version", i32 3} -!18 = !{!"clang version 3.5.0 "} -!19 = !{%struct.S* undef} -!20 = !DILocation(line: 2, scope: !9) - Index: test/DebugInfo/debug-info-always-inline.ll =================================================================== --- /dev/null +++ test/DebugInfo/debug-info-always-inline.ll @@ -1,143 +0,0 @@ -; RUN: opt < %s -always-inline -S | FileCheck %s -; -; Generated from the following C++ source with: -; clang -cc1 -disable-llvm-optzns -emit-llvm -g -stack-protector 2 test.cpp -; -; /* BEGIN SOURCE */ -; int __attribute__((always_inline)) foo() -; { -; int arr[10]; -; arr[0] = 5; -; int sum = 4; -; return sum; -; } -; -; extern void bar(); -; -; int main() -; { -; bar(); -; int i = foo(); -; return i; -; } -; /* END SOURCE */ - -; The patch that includes this test case, is addressing the following issue: -; -; When functions are inlined, instructions without debug information -; are attributed with the call site's DebugLoc. After inlining, inlined static -; allocas are moved to the caller's entry block, adjacent to the caller's original -; static alloca instructions. By retaining the call site's DebugLoc, these instructions -; may cause instructions that are subsequently inserted at the entry block to pick -; up the same DebugLoc. -; -; In the offending case stack protection inserts an instruction at the caller's -; entry block, which inadvertently picks up the inlined call's DebugLoc, because -; the entry block's first instruction is the recently moved inlined alloca instruction. -; -; The stack protection instruction then becomes part of the function prologue, with the -; result that the line number that is associated with the stack protection instruction -; is deemed to be the end of the function prologue. Since this line number is the -; call site's line number, setting a breakpoint at the function in the debugger -; will make the user stop at the line of the inlined call. - -; Note that without the stack protection instruction this effect would not occur -; because the allocas all get collapsed into a single instruction that reserves -; stack space and have no further influence on the prologue's line number information. - - -; The selected solution is to not attribute static allocas with the call site's -; DebugLoc. - -; At some point in the future, it may be desirable to describe the inlining -; in the alloca instructions, but then the code that handles prologues must -; be able to handle this correctly, including the late insertion of instructions -; into it. - -; In this context it is also important to distingush between functions -; with the "nodebug" attribute and those without it. Alloca instructions from -; nodebug functions should continue to have no DebugLoc, whereas those from -; non-nodebug functions (i.e. functions with debug information) may want to -; have their DebugLocs augmented with inlining information. - - -; Make sure that after inlining the call to foo() the alloca instructions for -; arr.i and sum.i do not retain debug information. - -; CHECK: %arr.i = alloca [10 x i32], align {{[0-9]*$}} -; CHECK: %sum.i = alloca i32, align {{[0-9]*$}} - - -; ModuleID = 'test.cpp' -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; Function Attrs: alwaysinline nounwind sspstrong -define i32 @_Z3foov() #0 { -entry: - %arr = alloca [10 x i32], align 16 - %sum = alloca i32, align 4 - call void @llvm.dbg.declare(metadata [10 x i32]* %arr, metadata !14), !dbg !18 - %arrayidx = getelementptr inbounds [10 x i32], [10 x i32]* %arr, i32 0, i64 0, !dbg !19 - store i32 5, i32* %arrayidx, align 4, !dbg !19 - call void @llvm.dbg.declare(metadata i32* %sum, metadata !20), !dbg !21 - store i32 4, i32* %sum, align 4, !dbg !21 - %0 = load i32, i32* %sum, align 4, !dbg !22 - ret i32 %0, !dbg !22 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata) #1 - -; Function Attrs: nounwind sspstrong -define i32 @main() #2 { -entry: - %retval = alloca i32, align 4 - %i = alloca i32, align 4 - store i32 0, i32* %retval - call void @_Z3barv(), !dbg !23 - call void @llvm.dbg.declare(metadata i32* %i, metadata !24), !dbg !25 - %call = call i32 @_Z3foov(), !dbg !25 - store i32 %call, i32* %i, align 4, !dbg !25 - %0 = load i32, i32* %i, align 4, !dbg !26 - ret i32 %0, !dbg !26 -} - -declare void @_Z3barv() #3 - -attributes #0 = { alwaysinline nounwind sspstrong "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind readnone } -attributes #2 = { nounwind sspstrong "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!11, !12} -!llvm.ident = !{!13} - -!0 = !{i32 786449, !1, i32 4, !"clang version 3.6.0 (217844)", i1 false, !"", i32 0, !2, !2, !3, !2, !2, !"", i32 1} ; [ DW_TAG_compile_unit ] [/home/user/test/] [DW_LANG_C_plus_plus] -!1 = !{!"", !"/home/user/test"} -!2 = !{} -!3 = !{!4, !10} -!4 = !{i32 786478, !5, !6, !"foo", !"foo", !"_Z3foov", i32 1, !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @_Z3foov, null, null, !2, i32 2} ; [ DW_TAG_subprogram ] [line 1] [def] [scope 2] [foo] -!5 = !{!"test.cpp", !"/home/user/test"} -!6 = !{i32 786473, !5} ; [ DW_TAG_file_type ] [/home/user/test/test.cpp] -!7 = !{i32 786453, i32 0, null, !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!8 = !{!9} -!9 = !{i32 786468, null, null, !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] -!10 = !{i32 786478, !5, !6, !"main", !"main", !"", i32 11, !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, !2, i32 12} ; [ DW_TAG_subprogram ] [line 11] [def] [scope 12] [main] -!11 = !{i32 2, !"Dwarf Version", i32 4} -!12 = !{i32 2, !"Debug Info Version", i32 1} -!13 = !{!"clang version 3.6.0 (217844)"} -!14 = !{i32 786688, !4, !"arr", !6, i32 3, !15, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [arr] [line 3] -!15 = !{i32 786433, null, null, !"", i32 0, i64 320, i64 32, i32 0, i32 0, !9, !16, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 320, align 32, offset 0] [from int] -!16 = !{!17} -!17 = !{i32 786465, i64 0, i64 10} ; [ DW_TAG_subrange_type ] [0, 9] -!18 = !DILocation(line: 3, scope: !4) -!19 = !DILocation(line: 4, scope: !4) -!20 = !{i32 786688, !4, !"sum", !6, i32 5, !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [sum] [line 5] -!21 = !DILocation(line: 5, scope: !4) -!22 = !DILocation(line: 6, scope: !4) -!23 = !DILocation(line: 13, scope: !10) -!24 = !{i32 786688, !10, !"i", !6, i32 14, !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [i] [line 14] -!25 = !DILocation(line: 14, scope: !10) -!26 = !DILocation(line: 15, scope: !10) Index: test/DebugInfo/debug-info-qualifiers.ll =================================================================== --- /dev/null +++ test/DebugInfo/debug-info-qualifiers.ll @@ -1,98 +0,0 @@ -; REQUIRES: object-emission -; Test (r)value qualifiers on C++11 non-static member functions. -; Generated from tools/clang/test/CodeGenCXX/debug-info-qualifiers.cpp -; -; class A { -; public: -; void l() const &; -; void r() const &&; -; }; -; -; void g() { -; A a; -; auto pl = &A::l; -; auto pr = &A::r; -; } -; -; RUN: %llc_dwarf -filetype=obj -O0 < %s | llvm-dwarfdump - | FileCheck %s -; CHECK: DW_TAG_subroutine_type DW_CHILDREN_yes -; CHECK-NEXT: DW_AT_reference DW_FORM_flag_present -; CHECK: DW_TAG_subroutine_type DW_CHILDREN_yes -; CHECK-NEXT: DW_AT_rvalue_reference DW_FORM_flag_present -; -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG_subprogram -; CHECK: DW_AT_name {{.*}}"l" -; CHECK-NOT: DW_TAG_subprogram -; CHECK: DW_AT_reference [DW_FORM_flag_present] (true) - -; CHECK: DW_TAG_subprogram -; CHECK-NOT: DW_TAG_subprogram -; CHECK: DW_AT_name {{.*}}"r" -; CHECK-NOT: DW_TAG_subprogram -; CHECK: DW_AT_rvalue_reference [DW_FORM_flag_present] (true) - -%class.A = type { i8 } - -; Function Attrs: nounwind -define void @_Z1gv() #0 { - %a = alloca %class.A, align 1 - %pl = alloca { i64, i64 }, align 8 - %pr = alloca { i64, i64 }, align 8 - call void @llvm.dbg.declare(metadata %class.A* %a, metadata !24, metadata !DIExpression()), !dbg !25 - call void @llvm.dbg.declare(metadata { i64, i64 }* %pl, metadata !26, metadata !DIExpression()), !dbg !31 - store { i64, i64 } { i64 ptrtoint (void (%class.A*)* @_ZNKR1A1lEv to i64), i64 0 }, { i64, i64 }* %pl, align 8, !dbg !31 - call void @llvm.dbg.declare(metadata { i64, i64 }* %pr, metadata !32, metadata !DIExpression()), !dbg !35 - store { i64, i64 } { i64 ptrtoint (void (%class.A*)* @_ZNKO1A1rEv to i64), i64 0 }, { i64, i64 }* %pr, align 8, !dbg !35 - ret void, !dbg !36 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -declare void @_ZNKR1A1lEv(%class.A*) - -declare void @_ZNKO1A1rEv(%class.A*) - -attributes #0 = { nounwind } -attributes #1 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!21, !22} -!llvm.ident = !{!23} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !16, globals: !2, imports: !2) -!1 = !DIFile(filename: "debug-info-qualifiers.cpp", directory: "") -!2 = !{} -!3 = !{!4} -!4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 2, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1A") -!5 = !DIFile(filename: "debug-info-qualifiers.cpp", directory: "") -!6 = !{!7, !13} -!7 = !DISubprogram(name: "l", linkageName: "_ZNKR1A1lEv", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped | DIFlagLValueReference, isOptimized: false, scopeLine: 5, file: !5, scope: !"_ZTS1A", type: !8) -!8 = !DISubroutineType(flags: DIFlagLValueReference, types: !9) -!9 = !{null, !10} -!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !11) -!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !"_ZTS1A") -!13 = !DISubprogram(name: "r", linkageName: "_ZNKO1A1rEv", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagObjectPointer | DIFlagRValueReference, isOptimized: false, scopeLine: 7, file: !5, scope: !"_ZTS1A", type: !14) -!14 = !DISubroutineType(flags: DIFlagRValueReference, types: !9) -!16 = !{!17} -!17 = distinct !DISubprogram(name: "g", linkageName: "_Z1gv", line: 10, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 10, file: !5, scope: !18, type: !19, function: void ()* @_Z1gv, variables: !2) -!18 = !DIFile(filename: "debug-info-qualifiers.cpp", directory: "") -!19 = !DISubroutineType(types: !20) -!20 = !{null} -!21 = !{i32 2, !"Dwarf Version", i32 4} -!22 = !{i32 1, !"Debug Info Version", i32 3} -!23 = !{!"clang version 3.5 "} -!24 = !DILocalVariable(name: "a", line: 11, scope: !17, file: !18, type: !4) -!25 = !DILocation(line: 11, scope: !17) -!26 = !DILocalVariable(name: "pl", line: 16, scope: !17, file: !18, type: !27) -!27 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !28, extraData: !"_ZTS1A") -!28 = !DISubroutineType(flags: DIFlagLValueReference, types: !29) -!29 = !{null, !30} -!30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A") -!31 = !DILocation(line: 16, scope: !17) -!32 = !DILocalVariable(name: "pr", line: 21, scope: !17, file: !18, type: !33) -!33 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !34, extraData: !"_ZTS1A") -!34 = !DISubroutineType(flags: DIFlagRValueReference, types: !29) -!35 = !DILocation(line: 21, scope: !17) -!36 = !DILocation(line: 22, scope: !17) Index: test/DebugInfo/debuginfofinder-forward-declaration.ll =================================================================== --- /dev/null +++ test/DebugInfo/debuginfofinder-forward-declaration.ll @@ -1,42 +0,0 @@ -; RUN: opt -analyze -module-debuginfo < %s | FileCheck %s - - -; This module is generated from the following c-code: -; -; > union X; -; > -; > struct Y { -; > union X *x; -; > }; -; > -; > struct Y y; - - -; CHECK: Type: Y from /tmp/minimal.c:3 DW_TAG_structure_type -; CHECK: Type: x from /tmp/minimal.c:4 DW_TAG_member -; CHECK: Type: DW_TAG_pointer_type -; CHECK: Type: X from /tmp/minimal.c:1 DW_TAG_structure_type - - -%struct.Y = type { %struct.X* } -%struct.X = type opaque - -@y = common global %struct.Y zeroinitializer, align 8 - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!10, !11} -!llvm.ident = !{!12} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (http://llvm.org/git/clang.git 247b30a043eb8f39ea3708e7e995089da0a6b00f) (http://llvm.org/git/llvm.git 6ecc7365a89c771fd229bdd9ffcc178684ea1aa5)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !2, globals: !3, imports: !2) -!1 = !DIFile(filename: "minimal.c", directory: "/tmp") -!2 = !{} -!3 = !{!4} -!4 = !DIGlobalVariable(name: "y", scope: !0, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, variable: %struct.Y* @y) -!5 = !DICompositeType(tag: DW_TAG_structure_type, name: "Y", file: !1, line: 3, size: 64, align: 64, elements: !6) -!6 = !{!7} -!7 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !5, file: !1, line: 4, baseType: !8, size: 64, align: 64) -!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64) -!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", file: !1, line: 1, flags: DIFlagFwdDecl) -!10 = !{i32 2, !"Dwarf Version", i32 4} -!11 = !{i32 2, !"Debug Info Version", i32 3} -!12 = !{!"clang version 3.7.0 (http://llvm.org/git/clang.git 247b30a043eb8f39ea3708e7e995089da0a6b00f) (http://llvm.org/git/llvm.git 6ecc7365a89c771fd229bdd9ffcc178684ea1aa5)"} Index: test/DebugInfo/debuginfofinder-multiple-cu.ll =================================================================== --- /dev/null +++ test/DebugInfo/debuginfofinder-multiple-cu.ll @@ -1,41 +0,0 @@ -; RUN: opt -analyze -module-debuginfo < %s | FileCheck %s - -; Produced from linking: -; /tmp/test1.c containing f() -; /tmp/test2.c containing g() - -; Verify that both compile units and both their contained functions are -; listed by DebugInfoFinder: -;CHECK: Compile unit: DW_LANG_C99 from /tmp/test1.c -;CHECK: Compile unit: DW_LANG_C99 from /tmp/test2.c -;CHECK: Subprogram: f from /tmp/test1.c:1 -;CHECK: Subprogram: g from /tmp/test2.c:1 - -define void @f() { - ret void, !dbg !14 -} - -define void @g() { - ret void, !dbg !15 -} - -!llvm.dbg.cu = !{!0, !8} -!llvm.module.flags = !{!13, !16} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (192092)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) -!1 = !DIFile(filename: "test1.c", directory: "/tmp") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "f", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, function: void ()* @f, variables: !2) -!5 = !DIFile(filename: "test1.c", directory: "/tmp") -!6 = !DISubroutineType(types: !7) -!7 = !{null} -!8 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (192092)", isOptimized: false, emissionKind: 0, file: !9, enums: !2, retainedTypes: !2, subprograms: !10, globals: !2, imports: !2) -!9 = !DIFile(filename: "test2.c", directory: "/tmp") -!10 = !{!11} -!11 = distinct !DISubprogram(name: "g", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 1, file: !9, scope: !12, type: !6, function: void ()* @g, variables: !2) -!12 = !DIFile(filename: "test2.c", directory: "/tmp") -!13 = !{i32 2, !"Dwarf Version", i32 4} -!14 = !DILocation(line: 1, scope: !4) -!15 = !DILocation(line: 1, scope: !11) -!16 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/dwarf-public-names.ll =================================================================== --- /dev/null +++ test/DebugInfo/dwarf-public-names.ll @@ -1,131 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -generate-dwarf-pub-sections=Enable -filetype=obj -o %t.o < %s -; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s -; ModuleID = 'dwarf-public-names.cpp' -; -; Generated from: -; -; struct C { -; void member_function(); -; static int static_member_function(); -; static int static_member_variable; -; }; -; -; int C::static_member_variable = 0; -; -; void C::member_function() { -; static_member_variable = 0; -; } -; -; int C::static_member_function() { -; return static_member_variable; -; } -; -; C global_variable; -; -; int global_function() { -; return -1; -; } -; -; namespace ns { -; void global_namespace_function() { -; global_variable.member_function(); -; } -; int global_namespace_variable = 1; -; } - -; Skip the output to the header of the pubnames section. -; CHECK: debug_pubnames -; CHECK: version = 0x0002 - -; Check for each name in the output. -; CHECK-DAG: "ns" -; CHECK-DAG: "C::static_member_function" -; CHECK-DAG: "global_variable" -; CHECK-DAG: "ns::global_namespace_variable" -; CHECK-DAG: "ns::global_namespace_function" -; CHECK-DAG: "global_function" -; CHECK-DAG: "C::static_member_variable" -; CHECK-DAG: "C::member_function" - -%struct.C = type { i8 } - -@_ZN1C22static_member_variableE = global i32 0, align 4 -@global_variable = global %struct.C zeroinitializer, align 1 -@_ZN2ns25global_namespace_variableE = global i32 1, align 4 - -define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 { -entry: - %this.addr = alloca %struct.C*, align 8 - store %struct.C* %this, %struct.C** %this.addr, align 8 - call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !28, metadata !DIExpression()), !dbg !30 - %this1 = load %struct.C*, %struct.C** %this.addr - store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31 - ret void, !dbg !32 -} - -declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone - -define i32 @_ZN1C22static_member_functionEv() nounwind uwtable align 2 { -entry: - %0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !33 - ret i32 %0, !dbg !33 -} - -define i32 @_Z15global_functionv() nounwind uwtable { -entry: - ret i32 -1, !dbg !34 -} - -define void @_ZN2ns25global_namespace_functionEv() nounwind uwtable { -entry: - call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !35 - ret void, !dbg !36 -} - -attributes #0 = { nounwind uwtable } -attributes #1 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!38} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, emissionKind: 0, file: !37, enums: !1, retainedTypes: !1, subprograms: !2, globals: !24, imports: !1) -!1 = !{} -!2 = !{!3, !18, !19, !20} -!3 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 9, file: !4, scope: null, type: !5, function: void (%struct.C*)* @_ZN1C15member_functionEv, declaration: !12, variables: !1) -!4 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") -!5 = !DISubroutineType(types: !6) -!6 = !{null, !7} -!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) -!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9) -!9 = !{!10, !12, !14} -!10 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11) -!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!12 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !4, scope: !8, type: !5, variables: !13) -!13 = !{} ; previously: invalid DW_TAG_base_type -!14 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !4, scope: !8, type: !15, variables: !17) -!15 = !DISubroutineType(types: !16) -!16 = !{!11} -!17 = !{} ; previously: invalid DW_TAG_base_type -!18 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 13, file: !4, scope: null, type: !15, function: i32 ()* @_ZN1C22static_member_functionEv, declaration: !14, variables: !1) -!19 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 19, file: !4, scope: !4, type: !15, function: i32 ()* @_Z15global_functionv, variables: !1) -!20 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", line: 24, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 24, file: !4, scope: !21, type: !22, function: void ()* @_ZN2ns25global_namespace_functionEv, variables: !1) -!21 = !DINamespace(name: "ns", line: 23, file: !4, scope: null) -!22 = !DISubroutineType(types: !23) -!23 = !{null} -!24 = !{!25, !26, !27} -!25 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, variable: i32* @_ZN1C22static_member_variableE, declaration: !10) -!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: %struct.C* @global_variable) -!27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11, variable: i32* @_ZN2ns25global_namespace_variableE) -!28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29) -!29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8) -!30 = !DILocation(line: 9, scope: !3) -!31 = !DILocation(line: 10, scope: !3) -!32 = !DILocation(line: 11, scope: !3) -!33 = !DILocation(line: 14, scope: !18) -!34 = !DILocation(line: 20, scope: !19) -!35 = !DILocation(line: 25, scope: !20) -!36 = !DILocation(line: 26, scope: !20) -!37 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") -!38 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/empty.ll =================================================================== --- /dev/null +++ test/DebugInfo/empty.ll @@ -1,31 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s -; RUN: %llc_dwarf -split-dwarf=Enable < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s - -; darwin has a workaround for a linker bug so it always emits one line table entry -; XFAIL: darwin - -; Expect no line table entry since there are no functions and file references in this compile unit -; CHECK: .debug_line contents: -; CHECK: Line table prologue: -; CHECK: total_length: 0x00000019 -; CHECK-NOT: file_names[ - -; CHECK: .debug_pubnames contents: -; CHECK-NOT: Offset - -; CHECK: .debug_pubtypes contents: -; CHECK-NOT: Offset - -; Don't emit DW_AT_addr_base when there are no addresses. -; FISSION-NOT: DW_AT_GNU_addr_base [DW_FORM_sec_offset] - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!5} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 143523)", isOptimized: true, emissionKind: 0, file: !4, enums: !2, retainedTypes: !2, subprograms: !2, globals: !2) -!2 = !{} -!3 = !DIFile(filename: "empty.c", directory: "/home/nlewycky") -!4 = !DIFile(filename: "empty.c", directory: "/home/nlewycky") -!5 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/enum-types.ll =================================================================== --- /dev/null +++ test/DebugInfo/enum-types.ll @@ -1,78 +0,0 @@ -; REQUIRES: object-emission -; -; RUN: %llc_dwarf -filetype=obj -O0 -dwarf-linkage-names=Enable < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; Make sure we can handle enums with the same identifier but in enum types of -; different compile units. -; rdar://17628609 - -; CHECK: DW_TAG_compile_unit -; CHECK: 0x[[ENUM:.*]]: DW_TAG_enumeration_type -; CHECK-NEXT: DW_AT_name {{.*}} "EA" -; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_Z4topA2EA" -; CHECK: DW_TAG_formal_parameter -; CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x{{.*}} => {0x[[ENUM]]}) - -; CHECK: DW_TAG_compile_unit -; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_Z4topB2EA" -; CHECK: DW_TAG_formal_parameter -; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[ENUM]] - -; Function Attrs: nounwind ssp uwtable -define void @_Z4topA2EA(i32 %sa) #0 { -entry: - %sa.addr = alloca i32, align 4 - store i32 %sa, i32* %sa.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %sa.addr, metadata !22, metadata !DIExpression()), !dbg !23 - ret void, !dbg !24 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -; Function Attrs: nounwind ssp uwtable -define void @_Z4topB2EA(i32 %sa) #0 { -entry: - %sa.addr = alloca i32, align 4 - store i32 %sa, i32* %sa.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %sa.addr, metadata !25, metadata !DIExpression()), !dbg !26 - ret void, !dbg !27 -} - -attributes #0 = { nounwind 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, !12} -!llvm.module.flags = !{!19, !20} -!llvm.ident = !{!21, !21} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214133) (llvm/trunk 214102:214132)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !6, globals: !11, imports: !11) -!1 = !DIFile(filename: "a.cpp", directory: "") -!2 = !{!3} -!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "EA", line: 1, size: 32, align: 32, file: !1, elements: !4, identifier: "_ZTS2EA") -!4 = !{!5} -!5 = !DIEnumerator(name: "EA_0", value: 0) ; [ DW_TAG_enumerator ] [EA_0 :: 0] -!6 = !{!7} -!7 = distinct !DISubprogram(name: "topA", linkageName: "_Z4topA2EA", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !8, type: !9, function: void (i32)* @_Z4topA2EA, variables: !11) -!8 = !DIFile(filename: "a.cpp", directory: "") -!9 = !DISubroutineType(types: !10) -!10 = !{null, !"_ZTS2EA"} -!11 = !{} -!12 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214133) (llvm/trunk 214102:214132)", isOptimized: false, emissionKind: 1, file: !13, enums: !14, retainedTypes: !14, subprograms: !16, globals: !11, imports: !11) -!13 = !DIFile(filename: "b.cpp", directory: "") -!14 = !{!15} -!15 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "EA", line: 1, size: 32, align: 32, file: !13, elements: !4, identifier: "_ZTS2EA") -!16 = !{!17} -!17 = distinct !DISubprogram(name: "topB", linkageName: "_Z4topB2EA", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !13, scope: !18, type: !9, function: void (i32)* @_Z4topB2EA, variables: !11) -!18 = !DIFile(filename: "b.cpp", directory: "") -!19 = !{i32 2, !"Dwarf Version", i32 2} -!20 = !{i32 2, !"Debug Info Version", i32 3} -!21 = !{!"clang version 3.5.0 (trunk 214102:214133) (llvm/trunk 214102:214132)"} -!22 = !DILocalVariable(name: "sa", line: 5, arg: 1, scope: !7, file: !8, type: !"_ZTS2EA") -!23 = !DILocation(line: 5, column: 14, scope: !7) -!24 = !DILocation(line: 6, column: 1, scope: !7) -!25 = !DILocalVariable(name: "sa", line: 5, arg: 1, scope: !17, file: !18, type: !"_ZTS2EA") -!26 = !DILocation(line: 5, column: 14, scope: !17) -!27 = !DILocation(line: 6, column: 1, scope: !17) Index: test/DebugInfo/enum.ll =================================================================== --- /dev/null +++ test/DebugInfo/enum.ll @@ -1,80 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t -; RUN: llvm-dwarfdump %t | FileCheck %s - -; IR generated from the following code compiled with clang -g: -; enum e1 { I, J = 0xffffffffU, K = 0xf000000000000000ULL } a; -; enum e2 { X }; -; void func() { -; int b = X; -; } - -; These values were previously being truncated to -1 and 0 respectively. - -; CHECK: debug_info contents -; CHECK: DW_TAG_enumeration_type -; CHECK-NEXT: DW_AT_name{{.*}} = "e1" -; CHECK-NOT: NULL -; CHECK: DW_TAG_enumerator -; CHECK-NOT: NULL -; CHECK: DW_TAG_enumerator -; CHECK-NEXT: DW_AT_name{{.*}} = "J" -; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (4294967295) -; CHECK-NOT: NULL -; CHECK: DW_TAG_enumerator -; CHECK-NEXT: DW_AT_name{{.*}} = "K" -; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (-1152921504606846976) - -; Check that we retain enums that aren't referenced by any variables, etc -; CHECK: DW_TAG_enumeration_type -; CHECK-NEXT: DW_AT_name{{.*}} = "e2" -; CHECK-NOT: NULL -; CHECK: DW_TAG_enumerator -; CHECK-NEXT: DW_AT_name{{.*}} = "X" - -@a = global i64 0, align 8 - -; Function Attrs: nounwind uwtable -define void @_Z4funcv() #0 { -entry: - %b = alloca i32, align 4 - call void @llvm.dbg.declare(metadata i32* %b, metadata !20, metadata !DIExpression()), !dbg !22 - store i32 0, i32* %b, align 4, !dbg !22 - ret void, !dbg !23 -} - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - -attributes #0 = { nounwind 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" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind readnone } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!19, !24} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !11, subprograms: !12, globals: !17, imports: !11) -!1 = !DIFile(filename: "enum.cpp", directory: "/tmp") -!2 = !{!3, !8} -!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "e1", line: 1, size: 64, align: 64, file: !1, elements: !4) -!4 = !{!5, !6, !7} -!5 = !DIEnumerator(name: "I", value: 0) ; [ DW_TAG_enumerator ] [I :: 0] -!6 = !DIEnumerator(name: "J", value: 4294967295) ; [ DW_TAG_enumerator ] [J :: 4294967295] -!7 = !DIEnumerator(name: "K", value: -1152921504606846976) ; [ DW_TAG_enumerator ] [K :: 17293822569102704640] -!8 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "e2", line: 2, size: 32, align: 32, file: !1, elements: !9) -!9 = !{!10} -!10 = !DIEnumerator(name: "X", value: 0) ; [ DW_TAG_enumerator ] [X :: 0] -!11 = !{} -!12 = !{!13} -!13 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcv", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !14, type: !15, function: void ()* @_Z4funcv, variables: !11) -!14 = !DIFile(filename: "enum.cpp", directory: "/tmp") -!15 = !DISubroutineType(types: !16) -!16 = !{null} -!17 = !{!18} -!18 = !DIGlobalVariable(name: "a", line: 1, isLocal: false, isDefinition: true, scope: null, file: !14, type: !3, variable: i64* @a) -!19 = !{i32 2, !"Dwarf Version", i32 3} -!20 = !DILocalVariable(name: "b", line: 4, scope: !13, file: !14, type: !21) -!21 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!22 = !DILocation(line: 4, scope: !13) -!23 = !DILocation(line: 5, scope: !13) -!24 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/global.ll =================================================================== --- /dev/null +++ test/DebugInfo/global.ll @@ -1,42 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t -; RUN: llvm-dwarfdump %t | FileCheck %s - -; Also test that the null streamer doesn't crash with debug info. -; RUN: %llc_dwarf -O0 -filetype=null < %s - -; generated from the following source compiled to bitcode with clang -g -O1 -; static int i; -; int main() { -; (void)&i; -; } - -; CHECK: debug_info contents -; CHECK: DW_TAG_variable - -; Function Attrs: nounwind readnone uwtable -define i32 @main() #0 { -entry: - ret i32 0, !dbg !12 -} - -attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!11, !13} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: true, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !9, imports: !2) -!1 = !DIFile(filename: "global.cpp", directory: "/tmp") -!2 = !{} -!3 = !{!4} -!4 = distinct !DISubprogram(name: "main", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !1, scope: !5, type: !6, function: i32 ()* @main, variables: !2) -!5 = !DIFile(filename: "global.cpp", directory: "/tmp") -!6 = !DISubroutineType(types: !7) -!7 = !{!8} -!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!9 = !{!10} -!10 = !DIGlobalVariable(name: "i", linkageName: "_ZL1i", line: 1, isLocal: true, isDefinition: true, scope: null, file: !5, type: !8) -!11 = !{i32 2, !"Dwarf Version", i32 3} -!12 = !DILocation(line: 4, scope: !4) -!13 = !{i32 1, !"Debug Info Version", i32 3} Index: test/DebugInfo/gvn.ll =================================================================== --- /dev/null +++ test/DebugInfo/gvn.ll @@ -1,114 +0,0 @@ -; RUN: opt < %s -gvn -S | FileCheck %s -; -; Produced at -O2 from: -; int a, b; -; void f1(int *p1) { -; if (b) -; a = 1; -; if (a && *p1) -; f4(); -; } -; int f2(int); -; void f3(void) { -; a = f2(1); -; f1(&a); -; } -target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" -target triple = "arm64-apple-ios" - -@a = common global i32 0, align 4 -@b = common global i32 0, align 4 - -; Function Attrs: nounwind -define void @f3() #0 { -entry: - ; Verify that the call still has a debug location after GVN. - ; CHECK: %call = tail call i32 @f2(i32 1) #{{[0-9]}}, !dbg - %call = tail call i32 @f2(i32 1) #3, !dbg !36 - store i32 %call, i32* @a, align 4, !dbg !36, !tbaa !25 - tail call void @llvm.dbg.value(metadata i32* @a, i64 0, metadata !11, metadata !21) #3, !dbg !39 - %0 = load i32, i32* @b, align 4, !dbg !39, !tbaa !25 - %tobool.i = icmp eq i32 %0, 0, !dbg !39 - br i1 %tobool.i, label %if.end.i, label %land.lhs.true.i.thread, !dbg !40 - -land.lhs.true.i.thread: ; preds = %entry - store i32 1, i32* @a, align 4, !dbg !41, !tbaa !25 - br label %if.then.3.i, !dbg !42 - -if.end.i: ; preds = %entry - ; This instruction has no debug location -- in this - ; particular case it was removed by a bug in SimplifyCFG. - %.pr = load i32, i32* @a, align 4 - - ; GVN is supposed to replace the load of %.pr with a direct reference to %call. - ; CHECK: %tobool2.i = icmp eq i32 %call, 0, !dbg - %tobool2.i = icmp eq i32 %.pr, 0, !dbg !43 - br i1 %tobool2.i, label %f1.exit, label %if.then.3.i, !dbg !43 - -if.then.3.i: ; preds = %if.end.i, %land.lhs.true.i.thread - %call.i = tail call i32 bitcast (i32 (...)* @f4 to i32 ()*)() #3, !dbg !44 - br label %f1.exit, !dbg !44 - -f1.exit: ; preds = %if.end.i, %if.then.3.i - ret void, !dbg !45 -} - -declare i32 @f2(i32) -declare i32 @f4(...) - -; Function Attrs: nounwind readnone -declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2 - -attributes #0 = { nounwind } -attributes #2 = { nounwind readnone } -attributes #3 = { nounwind } - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!18, !19} -!llvm.ident = !{!20} - -!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 245562) (llvm/trunk 245569)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3, globals: !15) -!1 = !DIFile(filename: "test.c", directory: "/") -!2 = !{} -!3 = !{!4, !12} -!4 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 2, type: !6, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, variables: !10) -!6 = !DISubroutineType(types: !7) -!7 = !{null, !8} -!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64) -!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) -!10 = !{!11} -!11 = !DILocalVariable(name: "p1", arg: 1, scope: !4, file: !1, line: 2, type: !8) -!12 = distinct !DISubprogram(name: "f3", scope: !1, file: !1, line: 9, type: !13, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, function: void ()* @f3, variables: !2) -!13 = !DISubroutineType(types: !14) -!14 = !{null} -!15 = !{!16, !17} -!16 = !DIGlobalVariable(name: "a", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i32* @a) -!17 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i32* @b) -!18 = !{i32 2, !"Dwarf Version", i32 2} -!19 = !{i32 2, !"Debug Info Version", i32 3} -!20 = !{!"clang version 3.8.0 (trunk 245562) (llvm/trunk 245569)"} -!21 = !DIExpression() -!22 = !DILocation(line: 2, scope: !4) -!23 = !DILocation(line: 3, scope: !24) -!24 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3) -!25 = !{!26, !26, i64 0} -!26 = !{!"int", !27, i64 0} -!27 = !{!"omnipotent char", !28, i64 0} -!28 = !{!"Simple C/C++ TBAA"} -!29 = !DILocation(line: 3, scope: !4) -!30 = !DILocation(line: 4, scope: !24) -!31 = !DILocation(line: 5, scope: !32) -!32 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5) -!33 = !DILocation(line: 5, scope: !4) -!34 = !DILocation(line: 6, scope: !32) -!35 = !DILocation(line: 7, scope: !4) -!36 = !DILocation(line: 5, scope: !32, inlinedAt: !37) -!37 = distinct !DILocation(line: 11, scope: !12) -!38 = !DILocation(line: 10, scope: !12) -!39 = !DILocation(line: 2, scope: !4, inlinedAt: !37) -!40 = !DILocation(line: 3, scope: !24, inlinedAt: !37) -!41 = !DILocation(line: 3, scope: !4, inlinedAt: !37) -!42 = !DILocation(line: 4, scope: !24, inlinedAt: !37) -!43 = !DILocation(line: 5, scope: !4, inlinedAt: !37) -!44 = !DILocation(line: 6, scope: !32, inlinedAt: !37) -!45 = !DILocation(line: 12, scope: !12) Index: test/DebugInfo/incorrect-variable-debugloc.ll =================================================================== --- /dev/null +++ test/DebugInfo/incorrect-variable-debugloc.ll @@ -1,391 +0,0 @@ -; REQUIRES: object-emission - -; RUN: %llc_dwarf -O2 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s - -; This is a test case that's as reduced as I can get it, though I haven't fully -; understood the mechanisms by which this bug occurs, so perhaps there's further -; simplification to be had (it's certainly a bit non-obvious what's going on). I -; hesitate to hand-craft or otherwise simplify the IR compared to what Clang -; generates as this is a particular tickling of optimizations and debug location -; propagation I want a realistic example of. - -; Generated with clang-tot -cc1 -g -O2 -w -std=c++11 -fsanitize=address,use-after-return -fcxx-exceptions -fexceptions -x c++ incorrect-variable-debug-loc.cpp -emit-llvm - -; struct A { -; int m_fn1(); -; }; -; -; struct B { -; void __attribute__((always_inline)) m_fn2() { i = 0; } -; int i; -; }; -; -; struct C { -; void m_fn3(); -; int j; -; B b; -; }; -; -; int fn1() { -; C A; -; A.b.m_fn2(); -; A.m_fn3(); -; } -; void C::m_fn3() { -; A().m_fn1(); -; b.m_fn2(); -; } - -; CHECK: DW_TAG_structure_type -; CHECK-NEXT: DW_AT_name {{.*}} "C" -; CHECK: [[M_FN3_DECL:.*]]: DW_TAG_subprogram -; CHECK-NOT: {{DW_TAG|NULL}} -; CHECK: DW_AT_name {{.*}} "m_fn3" - -; CHECK: DW_AT_specification {{.*}} {[[M_FN3_DECL]]} -; CHECK-NOT: DW_TAG -; CHECK: DW_TAG_formal_parameter -; CHECK-NOT: DW_TAG -; CHECK: DW_AT_name {{.*}} "this" - -%struct.C = type { i32, %struct.B } -%struct.B = type { i32 } -%struct.A = type { i8 } - -@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 1, void ()* @asan.module_ctor }] -@__asan_option_detect_stack_use_after_return = external global i32 -@__asan_gen_ = private unnamed_addr constant [11 x i8] c"1 32 8 1 A\00", align 1 -@__asan_gen_1 = private unnamed_addr constant [13 x i8] c"1 32 1 3 tmp\00", align 1 - -; Function Attrs: noreturn sanitize_address -define i32 @_Z3fn1v() #0 { -entry: - %MyAlloca = alloca [64 x i8], align 32, !dbg !39 - %0 = ptrtoint [64 x i8]* %MyAlloca to i64, !dbg !39 - %1 = load i32, i32* @__asan_option_detect_stack_use_after_return, !dbg !39 - %2 = icmp ne i32 %1, 0, !dbg !39 - br i1 %2, label %3, label %5 - -;