brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 057c82b Raw
73 lines · plain
1; RUN: llc %s -stop-before=finalize-isel -o - \2; RUN: | FileCheck %s3 4; Check basic lowering behaviour of dbg.assign intrinsics. The first5; assignment to `local`, which has been DSE'd, should be represented with a6; constant value DBG_VALUE. The second assignment should have a DBG_VALUE7; describing the stack home of the variable.8 9; $ cat test.c10; void esc(int*);11; void fun() {12;   int local = 5;13;   // ^ killed by v14;   local = 6;15;   esc(&local);16; }17; $ clang -O2 -g -emit -llvm -S test.c -o -18 19; CHECK: ![[LOCAL:[0-9]+]] = !DILocalVariable(name: "local",20; CHECK: DBG_VALUE 5, $noreg, ![[LOCAL]], !DIExpression(), debug-location ![[DBG:[0-9]+]]21; CHECK-NEXT: MOV32mi [[DEST:.*]], 1, $noreg, 0, $noreg, 622; CHECK-NEXT: DBG_VALUE [[DEST]], $noreg, ![[LOCAL]], !DIExpression(DW_OP_deref), debug-location ![[DBG]]23 24target triple = "x86_64-unknown-linux-gnu"25 26define dso_local void @fun() local_unnamed_addr !dbg !7 {27entry:28  %local = alloca i32, align 429  call void @llvm.dbg.assign(metadata i32 5, metadata !11, metadata !DIExpression(), metadata !30, metadata ptr %local, metadata !DIExpression()), !dbg !1630  store i32 6, ptr %local, align 4, !dbg !23, !DIAssignID !3131  call void @llvm.dbg.assign(metadata i32 6, metadata !11, metadata !DIExpression(), metadata !31, metadata ptr %local, metadata !DIExpression()), !dbg !1632  call void @esc(ptr nonnull %local), !dbg !2433  ret void, !dbg !2534}35 36declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)37 38declare !dbg !26 dso_local void @esc(ptr) local_unnamed_addr39 40!llvm.dbg.cu = !{!0}41!llvm.module.flags = !{!3, !4, !5, !1000}42!llvm.ident = !{!6}43 44!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)45!1 = !DIFile(filename: "test.c", directory: "/")46!2 = !{}47!3 = !{i32 7, !"Dwarf Version", i32 4}48!4 = !{i32 2, !"Debug Info Version", i32 3}49!5 = !{i32 1, !"wchar_size", i32 4}50!6 = !{!"clang version 12.0.0"}51!7 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)52!8 = !DISubroutineType(types: !9)53!9 = !{null}54!10 = !{!11}55!11 = !DILocalVariable(name: "local", scope: !7, file: !1, line: 3, type: !12)56!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)57!14 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !12)58!15 = !DILocation(line: 3, column: 3, scope: !7)59!16 = !DILocation(line: 0, scope: !7)60!17 = !DILocation(line: 4, column: 3, scope: !7)61!18 = !DILocation(line: 4, column: 16, scope: !7)62!23 = !DILocation(line: 5, column: 9, scope: !7)63!24 = !DILocation(line: 6, column: 3, scope: !7)64!25 = !DILocation(line: 7, column: 1, scope: !7)65!26 = !DISubprogram(name: "esc", scope: !1, file: !1, line: 1, type: !27, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)66!27 = !DISubroutineType(types: !28)67!28 = !{null, !29}68!29 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)69!30 = distinct !DIAssignID()70!31 = distinct !DIAssignID()71 72!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}73