56 lines · plain
1; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=none -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s2; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=all -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s3; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=none -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s4; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=all -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s5 6 7; CHECK: DW_TAG_variable8; CHECK-NEXT: DW_AT_const_value (7)9; CHECK-NEXT: DW_AT_name ("i")10 11 12; void f1();13; void test() {14; // constant value with a single location description15; // Shouldn't change with BB-sections16; int i = 7;17; f1();18; }19; $ clang++ -S -emit-llvm -g -O2 const_value_2.cc20 21 22 23define dso_local void @_Z4testv() local_unnamed_addr !dbg !7 {24entry:25 call void @llvm.dbg.value(metadata i32 7, metadata !11, metadata !DIExpression()), !dbg !1326 tail call void @_Z2f1v(), !dbg !1427 ret void, !dbg !1528}29 30declare !dbg !16 dso_local void @_Z2f1v() local_unnamed_addr31 32; Function Attrs: nofree nosync nounwind readnone speculatable willreturn33declare void @llvm.dbg.value(metadata, metadata, metadata)34 35!llvm.dbg.cu = !{!0}36!llvm.module.flags = !{!3, !4, !5}37!llvm.ident = !{!6}38 39!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (git@github.com:llvm/llvm-project.git 593cb4655097552ac6d81ce18a2851ae0feb8d3c)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)40!1 = !DIFile(filename: "const_value_2.cc", directory: "/code")41!2 = !{}42!3 = !{i32 7, !"Dwarf Version", i32 4}43!4 = !{i32 2, !"Debug Info Version", i32 3}44!5 = !{i32 1, !"wchar_size", i32 4}45!6 = !{!"clang version 13.0.0 (git@github.com:llvm/llvm-project.git 593cb4655097552ac6d81ce18a2851ae0feb8d3c)"}46!7 = distinct !DISubprogram(name: "test", linkageName: "_Z4testv", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)47!8 = !DISubroutineType(types: !9)48!9 = !{null}49!10 = !{!11}50!11 = !DILocalVariable(name: "i", scope: !7, file: !1, line: 8, type: !12)51!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)52!13 = !DILocation(line: 0, scope: !7)53!14 = !DILocation(line: 9, column: 3, scope: !7)54!15 = !DILocation(line: 10, column: 1, scope: !7)55!16 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)56