1c4b3ad81SAlexey Samsonov; RUN: llc %s -mtriple=x86_64-pc-linux-gnu -O0 -filetype=obj -o %t
27bc1b282SAdrian Prantl; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
3c4b3ad81SAlexey Samsonov
4c4b3ad81SAlexey Samsonov; If stack is realigned, we shouldn't describe locations of local
5c4b3ad81SAlexey Samsonov; variables by giving offset from the frame pointer (%rbp):
6c4b3ad81SAlexey Samsonov; push %rpb
7c4b3ad81SAlexey Samsonov; mov  %rsp,%rbp
8c4b3ad81SAlexey Samsonov; and  ALIGNMENT,%rsp ; (%rsp and %rbp are different now)
9c4b3ad81SAlexey Samsonov; It's better to use offset from %rsp instead.
10c4b3ad81SAlexey Samsonov
11c4b3ad81SAlexey Samsonov; DW_AT_location of variable "x" shouldn't be equal to
12c4b3ad81SAlexey Samsonov; (DW_OP_fbreg: .*): DW_OP_fbreg has code 0x91
13c4b3ad81SAlexey Samsonov
14c4b3ad81SAlexey Samsonov; CHECK: {{0x.* DW_TAG_variable}}
15c4b3ad81SAlexey Samsonov; CHECK-NOT: {{DW_AT_location.*DW_FORM_block1.*0x.*91}}
16c4b3ad81SAlexey Samsonov; CHECK: NULL
17c4b3ad81SAlexey Samsonov
18d4bff303SPeter Collingbournedefine void @_Z3runv() nounwind uwtable !dbg !5 {
19c4b3ad81SAlexey Samsonoventry:
20c4b3ad81SAlexey Samsonov  %x = alloca i32, align 32
21a9308c49SDuncan P. N. Exon Smith  call void @llvm.dbg.declare(metadata i32* %x, metadata !9, metadata !DIExpression()), !dbg !12
22c4b3ad81SAlexey Samsonov  ret void, !dbg !13
23c4b3ad81SAlexey Samsonov}
24c4b3ad81SAlexey Samsonov
2587b7eb9dSAdrian Prantldeclare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
26c4b3ad81SAlexey Samsonov
27c4b3ad81SAlexey Samsonov!llvm.dbg.cu = !{!0}
28409558f8SManman Ren!llvm.module.flags = !{!15}
29c4b3ad81SAlexey Samsonov
3075819aedSAdrian Prantl!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.2 (trunk 155696:155697) (llvm/trunk 155696)", isOptimized: false, emissionKind: FullDebug, file: !14, enums: !1, retainedTypes: !1, globals: !1, imports:  !1)
31be7ea19bSDuncan P. N. Exon Smith!1 = !{}
32*2c864551SShiva Chen!5 = distinct !DISubprogram(name: "run", linkageName: "_Z3runv", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !14, scope: !6, type: !7, retainedNodes: !1)
33a9308c49SDuncan P. N. Exon Smith!6 = !DIFile(filename: "test.cc", directory: "/home/samsonov/debuginfo")
34a9308c49SDuncan P. N. Exon Smith!7 = !DISubroutineType(types: !8)
35be7ea19bSDuncan P. N. Exon Smith!8 = !{null}
36ed013cd2SDuncan P. N. Exon Smith!9 = !DILocalVariable(name: "x", line: 2, scope: !10, file: !6, type: !11)
37a9308c49SDuncan P. N. Exon Smith!10 = distinct !DILexicalBlock(line: 1, column: 12, file: !14, scope: !5)
38a9308c49SDuncan P. N. Exon Smith!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
39a9308c49SDuncan P. N. Exon Smith!12 = !DILocation(line: 2, column: 7, scope: !10)
40a9308c49SDuncan P. N. Exon Smith!13 = !DILocation(line: 3, column: 1, scope: !10)
41a9308c49SDuncan P. N. Exon Smith!14 = !DIFile(filename: "test.cc", directory: "/home/samsonov/debuginfo")
42e274180fSDuncan P. N. Exon Smith!15 = !{i32 1, !"Debug Info Version", i32 3}
43