1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
llvm-mirror/test/CodeGen/MIR/X86/stack-object-debug-info.mir
Adrian Prantl fb3abba237 [PR27284] Reverse the ownership between DICompileUnit and DISubprogram.
Currently each Function points to a DISubprogram and DISubprogram has a
scope field. For member functions the scope is a DICompositeType. DIScopes
point to the DICompileUnit to facilitate type uniquing.

Distinct DISubprograms (with isDefinition: true) are not part of the type
hierarchy and cannot be uniqued. This change removes the subprograms
list from DICompileUnit and instead adds a pointer to the owning compile
unit to distinct DISubprograms. This would make it easy for ThinLTO to
strip unneeded DISubprograms and their transitively referenced debug info.

Motivation
----------

Materializing DISubprograms is currently the most expensive operation when
doing a ThinLTO build of clang.

We want the DISubprogram to be stored in a separate Bitcode block (or the
same block as the function body) so we can avoid having to expensively
deserialize all DISubprograms together with the global metadata. If a
function has been inlined into another subprogram we need to store a
reference the block containing the inlined subprogram.

Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script
that updates LLVM IR testcases to the new format.

http://reviews.llvm.org/D19034
<rdar://problem/25256815>

llvm-svn: 266446
2016-04-15 15:57:41 +00:00

69 lines
2.4 KiB
YAML

# RUN: llc -march=x86-64 -start-after machine-sink -stop-after machine-sink -o /dev/null %s 2>&1 | FileCheck %s
# This test ensures that the MIR parser parses the stack object's debug info
# correctly.
--- |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
define void @foo() #1 {
entry:
%x.i = alloca i8, align 1
%y.i = alloca [256 x i8], align 16
%0 = bitcast [256 x i8]* %y.i to i8*
br label %for.body
for.body:
%1 = bitcast [256 x i8]* %y.i to i8*
call void @llvm.lifetime.end(i64 -1, i8* %1) #3
call void @llvm.lifetime.start(i64 -1, i8* %0) #3
call void @llvm.dbg.declare(metadata i8* %0, metadata !4, metadata !7) #3, !dbg !8
br label %for.body
}
declare void @llvm.lifetime.start(i64, i8* nocapture) #2
declare void @llvm.lifetime.end(i64, i8* nocapture) #2
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind ssp uwtable }
attributes #2 = { nounwind argmemonly }
attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3}
!0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
!1 = !DIFile(filename: "t.c", directory: "")
!2 = !{}
!3 = !{i32 1, !"Debug Info Version", i32 3}
!4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !9)
!5 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
!6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
!7 = !DIExpression()
!8 = !DILocation(line: 0, scope: !5)
!9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 2048, align: 8, elements: !10)
!10 = !{!11}
!11 = !DISubrange(count: 256)
...
---
name: foo
isSSA: true
tracksRegLiveness: true
frameInfo:
maxAlignment: 16
# CHECK-LABEL: foo
# CHECK: stack:
# CHECK: - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
# CHECK-NEXT: di-expression: '!10', di-location: '!11' }
stack:
- { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
di-expression: '!7', di-location: '!8' }
body: |
bb.0.entry:
successors: %bb.1.for.body
bb.1.for.body:
successors: %bb.1.for.body
DBG_VALUE %stack.0.y.i, 0, !4, !7, debug-location !8
JMP_1 %bb.1.for.body
...