137 changes: 137 additions & 0 deletions llvm/test/DebugInfo/Generic/dwarf-public-names.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
; RUN: %llc_dwarf -debugger-tune=gdb -filetype=obj -o %t.o < %s
; RUN: llvm-dwarfdump -debug-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"

source_filename = "test/DebugInfo/Generic/dwarf-public-names.ll"

%struct.C = type { i8 }

@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0
@global_variable = global %struct.C zeroinitializer, align 1, !dbg !15
@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17

; Function Attrs: nounwind uwtable
define void @_ZN1C15member_functionEv(ptr %this) #0 align 2 !dbg !23 {
entry:
%this.addr = alloca ptr, align 8
store ptr %this, ptr %this.addr, align 8
call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !24, metadata !26), !dbg !27
%this1 = load ptr, ptr %this.addr
store i32 0, ptr @_ZN1C22static_member_variableE, align 4, !dbg !28
ret void, !dbg !29
}

; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

; Function Attrs: nounwind uwtable
define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 {
entry:
%0 = load i32, ptr @_ZN1C22static_member_variableE, align 4, !dbg !31
ret i32 %0, !dbg !31
}

; Function Attrs: nounwind uwtable
define i32 @_Z15global_functionv() #0 !dbg !32 {
entry:
ret i32 -1, !dbg !33
}

; Function Attrs: nounwind uwtable
define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 {
entry:
call void @_ZN1C15member_functionEv(ptr @global_variable), !dbg !37
ret void, !dbg !38
}

attributes #0 = { nounwind uwtable }
attributes #1 = { nounwind readnone }

!llvm.dbg.cu = !{!20}
!llvm.module.flags = !{!22}

!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5)
!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, align: 8, elements: !4)
!3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
!4 = !{!5, !7, !12}
!5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember)
!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{null, !10}
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
!11 = !{}
!12 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: !2, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11)
!13 = !DISubroutineType(types: !14)
!14 = !{!6}
!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
!16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type
!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
!18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true)
!19 = !DINamespace(name: "ns", scope: null)
!20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type
!21 = !{!0, !15, !17}
!22 = !{i32 1, !"Debug Info Version", i32 3}
!23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, retainedNodes: !11)
!24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer)
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64)
!26 = !DIExpression()
!27 = !DILocation(line: 9, scope: !23)
!28 = !DILocation(line: 10, scope: !23)
!29 = !DILocation(line: 11, scope: !23)
!30 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: null, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !12, retainedNodes: !11)
!31 = !DILocation(line: 14, scope: !30)
!32 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", scope: !3, file: !3, line: 19, type: !13, isLocal: false, isDefinition: true, scopeLine: 19, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11)
!33 = !DILocation(line: 20, scope: !32)
!34 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", scope: !19, file: !3, line: 24, type: !35, isLocal: false, isDefinition: true, scopeLine: 24, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11)
!35 = !DISubroutineType(types: !36)
!36 = !{null}
!37 = !DILocation(line: 25, scope: !34)
!38 = !DILocation(line: 26, scope: !34)

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: %llc_dwarf -mtriple=x86_64-unknown-linux -filetype=obj -O0 < %s | llvm-dwarfdump -debug-info - | FileCheck %s
; RUN: %llc_dwarf -filetype=obj -O0 < %s | llvm-dwarfdump -debug-info - | FileCheck %s

; generated by clang from:
; struct foo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: %llc_dwarf -mtriple=x86_64-unknown-linux-gnu -filetype=obj -O0 < %s > %t
; RUN: %llc_dwarf -filetype=obj -O0 < %s > %t
; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s
; CHECK: [[TYPE:.*]]: DW_TAG_structure_type
; Make sure we correctly handle containing type of a struct being a type identifier.
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/Generic/univariant-discriminated-union.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
; CHECK: DW_AT_alignment
; CHECK: DW_AT_data_member_location [DW_FORM_data1] (0x00)

%F = type { [0 x i8], i64, [8 x i8] }
%F = type { [0 x i8], ptr, [8 x i8] }
%"F::Nope" = type {}

define internal void @_ZN2e34main17h934ff72f9a38d4bbE() unnamed_addr #0 !dbg !5 {
start:
%qq = alloca %F, align 8
call void @llvm.dbg.declare(metadata ptr %qq, metadata !10, metadata !28), !dbg !29
store i64 0, ptr %qq, !dbg !29
store ptr null, ptr %qq, !dbg !29
ret void, !dbg !30
}

Expand Down
5 changes: 2 additions & 3 deletions llvm/test/DebugInfo/X86/fi-piece.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_abstract_origin
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg -8, DW_OP_piece 0x2, DW_OP_fbreg -12, DW_OP_piece 0x2)
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg -4, DW_OP_piece 0x2, DW_OP_fbreg -8, DW_OP_piece 0x2)
; CHECK-NEXT: DW_AT_abstract_origin {{.*}}"a"
; Inlined variable, not to be merged.
; CHECK-NOT: DW_TAG
Expand All @@ -25,11 +25,10 @@ define void @f() #0 !dbg !8 {
entry:
%a = alloca i16, align 4
%b = alloca i16, align 4
%c = alloca { i16, i16 }, align 4
call void @llvm.dbg.declare(metadata ptr %a, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 16)), !dbg !14
store i16 1, ptr %a, align 4, !dbg !14
call void @llvm.dbg.declare(metadata ptr %b, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 16, 16)), !dbg !16
call void @llvm.dbg.declare(metadata ptr %c, metadata !11, metadata !13), !dbg !17
call void @llvm.dbg.declare(metadata ptr %a, metadata !11, metadata !13), !dbg !17
store i16 2, ptr %b, align 4, !dbg !17
ret void
}
Expand Down
80 changes: 0 additions & 80 deletions llvm/test/DebugInfo/invalid-sizes.ll

This file was deleted.

4 changes: 1 addition & 3 deletions llvm/test/Linker/type-unique-odr-a.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; REQUIRES: x86-registered-target
; REQUIRES: object-emission
;
; RUN: llvm-link %s %p/type-unique-odr-b.ll -S -o - \
; RUN: | %llc_dwarf -dwarf-linkage-names=All -filetype=obj -O0 \
Expand Down Expand Up @@ -56,8 +56,6 @@

; ModuleID = 'type-unique-odr-a.cpp'

target triple = "x86_64-unknown-linux-gnu"

%class.A = type { i32 }

; Function Attrs: nounwind
Expand Down
2 changes: 0 additions & 2 deletions llvm/test/Linker/type-unique-odr-b.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

; ModuleID = 'type-unique-odr-b.cpp'

target triple = "x86_64-unknown-linux-gnu"

%class.A = type { i32 }

; Function Attrs: nounwind
Expand Down
4 changes: 1 addition & 3 deletions llvm/test/Linker/type-unique-simple2-a.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; REQUIRES: x86-registered-target
; REQUIRES: object-emission
;
; RUN: llvm-link %s %p/type-unique-simple2-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -v -debug-info - | FileCheck %s
;
Expand Down Expand Up @@ -26,8 +26,6 @@

; ModuleID = 'a.cpp'

target triple = "x86_64-unknown-linux-gnu"

%class.A = type { ptr }

@_ZTV1A = external unnamed_addr constant [4 x ptr]
Expand Down
2 changes: 0 additions & 2 deletions llvm/test/Linker/type-unique-simple2-b.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
; target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
; target triple = "x86_64-apple-macosx10.9.0"

target triple = "x86_64-unknown-linux-gnu"

%class.A = type { ptr }

@_ZTV1A = unnamed_addr constant [4 x ptr] [ptr null, ptr @_ZTI1A, ptr @_ZN1A6setFooEv, ptr @_ZN1A6getFooEv]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
define i32 @foo(<vscale x 2 x i32> %x) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ARR:%.*]] = alloca [4 x i32], align 8
; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[ARR]], metadata [[META8:![0-9]+]], metadata !DIExpression()), !dbg [[DBG14:![0-9]+]]
; CHECK-NEXT: [[ARR:%.*]] = alloca i32, align 8
; CHECK-NEXT: call void @llvm.dbg.value(metadata <vscale x 2 x i32> undef, metadata [[META8:![0-9]+]], metadata !DIExpression()), !dbg [[DBG14:![0-9]+]]
; CHECK-NEXT: store <vscale x 2 x i32> [[X:%.*]], ptr [[ARR]], align 8
; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[ARR]], align 8
; CHECK-NEXT: ret i32 [[RES]]
;
entry:
%arr = alloca [4 x i32], align 4
%arr = alloca i32, align 4
call void @llvm.dbg.declare(metadata ptr %arr, metadata !8, metadata !DIExpression()), !dbg !14
store <vscale x 2 x i32> %x, ptr %arr, align 4
%res = load i32, ptr %arr
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/InstCombine/dbg-simplify-alloca-size.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)

; CHECK-LABEL: @toplevel(
; CHECK: entry:
; CHECK-NEXT: %pixels1 = alloca [4 x i8], align 1
; CHECK-NEXT: %pixels1 = alloca [3 x i8], align 1
; CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr %pixels1, metadata ![[MD:[0-9]+]], metadata !DIExpression()), !dbg ![[DBG:[0-9]+]]
; CHECK-NEXT: call void @foo(ptr nonnull %pixels1)
; CHECK-NEXT: ret void
define dso_local void @toplevel() {
entry:
%pixels = alloca i8, i32 4
%pixels = alloca i8, i32 3
call void @llvm.dbg.declare(metadata ptr %pixels, metadata !11, metadata !DIExpression()), !dbg !12
call void @foo(ptr %pixels)
ret void
Expand Down
8 changes: 3 additions & 5 deletions llvm/test/Transforms/Util/dbg-user-of-aext.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
; opposed to the operand of a [s|z]ext).
; RUN: opt -S -passes='sroa' %s | FileCheck %s

target datalayout = "i64:64"

; Built from:
; struct foo { bool b; long i; };
; void f(bool b, bool expr, foo g) {
Expand All @@ -14,15 +12,15 @@ target datalayout = "i64:64"

; Expect two fragments:
; * first starting at bit 0, 8 bits (for the bool)
; * second starting at bit 64, 64 bits (for the long)
; (this happens to create/demonstrate a gap from bits [7, 64))
; * second starting at bit 32, 32 bits (for the long)
; (this happens to create/demonstrate a gap from bits [7, 32))

; But also check that a complex expression is not used for a lone bool
; parameter. It can reference the register it's in directly without masking off
; high bits or anything

; CHECK: call void @llvm.dbg.value(metadata i8 %g.coerce0, metadata ![[VAR_STRUCT:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8))
; CHECK: call void @llvm.dbg.value(metadata i64 %g.coerce1, metadata ![[VAR_STRUCT]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64))
; CHECK: call void @llvm.dbg.value(metadata i64 %g.coerce1, metadata ![[VAR_STRUCT]], metadata !DIExpression(DW_OP_LLVM_fragment, 32, 64))
; CHECK: call void @llvm.dbg.value(metadata i8 %frombool, metadata ![[VAR_BOOL:[0-9]+]], metadata !DIExpression())
; CHECK: call void @llvm.dbg.value(metadata i8 %frombool1, metadata ![[VAR_FRAG:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 4))

Expand Down