1 ; RUN: llc -filetype=obj -mtriple=powerpc64le-unknown-linux-gnu < %s | \
2 ; RUN: llvm-dwarfdump -debug-info - | FileCheck %s
3 ; RUN: llc -filetype=obj -mtriple=powerpc64le-unknown-linux-gnu \
4 ; RUN: -strict-dwarf=true < %s | llvm-dwarfdump -debug-info - | \
5 ; RUN: FileCheck %s -check-prefix=STRICT
7 ; We also check that with/without -strict-dwarf=true, the location attribute
8 ; is not changed. The location attribute adding will call DwarfUnit::addUInt()
9 ; which contains a attribute 0, we want to make sure the strict-dwarf handling
10 ; is also right for attribute 0.
11 ; For this case, the location attribute adding is for global variable @_ZL3var
12 ; and the call chain to addUInt() is:
13 ; 1: DwarfCompileUnit::addLocationAttribute()
14 ; 2: DwarfUnit::addOpAddress()
15 ; 3: DwarfUnit::addUInt()
16 ; 4: addUInt(Block, (dwarf::Attribute)0, Form, Integer);
18 ; CHECK: DW_AT_name ("var")
20 ; CHECK: DW_AT_alignment
21 ; CHECK: DW_AT_location (DW_OP_addr 0x0)
22 ; CHECK: DW_AT_noreturn
24 ; STRICT: DW_AT_name ("var")
25 ; STRICT-NOT: DW_AT_alignment
27 ; STRICT: DW_AT_location (DW_OP_addr 0x0)
28 ; STRICT-NOT: DW_AT_noreturn
30 @_ZL3var = internal global i32 0, align 16, !dbg !0
32 ; Function Attrs: noinline noreturn optnone uwtable mustprogress
33 define dso_local void @_Z1fv() #0 !dbg !12 {
35 call void @_Z4exitv(), !dbg !15
39 declare void @_Z4exitv()
41 ; Function Attrs: noinline nounwind optnone uwtable mustprogress
42 define dso_local signext i32 @_Z3foov() !dbg !17 {
44 %0 = load i32, i32* @_ZL3var, align 16, !dbg !21
49 !llvm.module.flags = !{!7, !8, !9, !10}
52 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
53 !1 = distinct !DIGlobalVariable(name: "var", linkageName: "_ZL3var", scope: !2, file: !3, line: 2, type: !6, isLocal: true, isDefinition: true, align: 128)
54 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)
55 !3 = !DIFile(filename: "t.cpp", directory: "./")
58 !6 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
59 !7 = !{i32 7, !"Dwarf Version", i32 4}
60 !8 = !{i32 2, !"Debug Info Version", i32 3}
61 !9 = !{i32 1, !"wchar_size", i32 4}
62 !10 = !{i32 7, !"uwtable", i32 1}
63 !11 = !{!"clang version 13.0.0"}
64 !12 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", scope: !3, file: !3, line: 4, type: !13, scopeLine: 4, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
65 !13 = !DISubroutineType(types: !14)
67 !15 = !DILocation(line: 5, column: 1, scope: !12)
68 !16 = !DILocation(line: 7, column: 1, scope: !12)
69 !17 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !3, file: !3, line: 10, type: !18, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
70 !18 = !DISubroutineType(types: !19)
72 !20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
73 !21 = !DILocation(line: 12, column: 18, scope: !17)
74 !22 = !DILocation(line: 12, column: 11, scope: !17)