1; RUN: llc %s -mtriple=x86_64-pc-linux-gnu -O0 -filetype=obj -o %t
2; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
3
4; If stack is realigned, we shouldn't describe locations of local
5; variables by giving offset from the frame pointer (%rbp):
6; push %rpb
7; mov  %rsp,%rbp
8; and  ALIGNMENT,%rsp ; (%rsp and %rbp are different now)
9; It's better to use offset from %rsp instead.
10
11; DW_AT_location of variable "x" shouldn't be equal to
12; (DW_OP_fbreg: .*): DW_OP_fbreg has code 0x91
13
14; CHECK: {{0x.* DW_TAG_variable}}
15; CHECK-NOT: {{DW_AT_location.*DW_FORM_block1.*0x.*91}}
16; CHECK: NULL
17
18define void @_Z3runv() nounwind uwtable {
19entry:
20  %x = alloca i32, align 32
21  call void @llvm.dbg.declare(metadata i32* %x, metadata !9, metadata !MDExpression()), !dbg !12
22  ret void, !dbg !13
23}
24
25declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
26
27!llvm.dbg.cu = !{!0}
28!llvm.module.flags = !{!15}
29
30!0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.2 (trunk 155696:155697) (llvm/trunk 155696)", isOptimized: false, emissionKind: 0, file: !14, enums: !1, retainedTypes: !1, subprograms: !3, globals: !1, imports:  !1)
31!1 = !{}
32!3 = !{!5}
33!5 = !MDSubprogram(name: "run", linkageName: "_Z3runv", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !14, scope: !6, type: !7, function: void ()* @_Z3runv, variables: !1)
34!6 = !MDFile(filename: "test.cc", directory: "/home/samsonov/debuginfo")
35!7 = !MDSubroutineType(types: !8)
36!8 = !{null}
37!9 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "x", line: 2, scope: !10, file: !6, type: !11)
38!10 = distinct !MDLexicalBlock(line: 1, column: 12, file: !14, scope: !5)
39!11 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
40!12 = !MDLocation(line: 2, column: 7, scope: !10)
41!13 = !MDLocation(line: 3, column: 1, scope: !10)
42!14 = !MDFile(filename: "test.cc", directory: "/home/samsonov/debuginfo")
43!15 = !{i32 1, !"Debug Info Version", i32 3}
44