brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · cc8bbb7 Raw
64 lines · plain
1; RUN: opt -passes=mem2reg -S %s -o - \2; RUN: | FileCheck %s --implicit-check-not="#dbg_"3 4;; Test assignment tracking debug info when mem2reg promotes a single-store5;; alloca. Additionally, check that all the dbg.assigns linked to the alloca6;; are cleaned up, including duplciates.7 8; CHECK: entry:9; CHECK-NEXT: #dbg_value(i32 %a, ![[B:[0-9]+]]10; CHECK-NEXT: #dbg_value(i32 %a, ![[A:[0-9]+]]11; CHECK-NEXT: ret12 13; CHECK-DAG: ![[A]] = !DILocalVariable(name: "a",14; CHECK-DAG: ![[B]] = !DILocalVariable(name: "b",15 16;; 1. using source:17;; $ cat test.cpp18;; int f(int a) { return a; }19;; 2. manually duplicating the dbg.assign lnked to a's alloca to ensure20;;    duplicates are still cleaned up,21;; 3. and with a dbg.assign for another variable ("b") attached to a's alloca22;;    to check that a dbg.value is generated for the variable to represent the23;;    store despite the store not having a dbg.assign linked for it.24 25; Function Attrs: mustprogress nounwind uwtable26define dso_local noundef i32 @_Z1fi(i32 noundef %a) #0 !dbg !7 {27entry:28  %a.addr = alloca i32, align 4, !DIAssignID !1329  call void @llvm.dbg.assign(metadata i1 undef, metadata !12, metadata !DIExpression(), metadata !13, metadata ptr %a.addr, metadata !DIExpression()), !dbg !1430  call void @llvm.dbg.assign(metadata i1 undef, metadata !12, metadata !DIExpression(), metadata !13, metadata ptr %a.addr, metadata !DIExpression()), !dbg !1431  call void @llvm.dbg.assign(metadata i1 undef, metadata !22, metadata !DIExpression(), metadata !13, metadata ptr %a.addr, metadata !DIExpression()), !dbg !1432  store i32 %a, ptr %a.addr, align 4, !DIAssignID !1933  call void @llvm.dbg.assign(metadata i32 %a, metadata !12, metadata !DIExpression(), metadata !19, metadata ptr %a.addr, metadata !DIExpression()), !dbg !1434  %0 = load i32, ptr %a.addr, align 4, !dbg !2035  ret i32 %0, !dbg !2136}37 38declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)39 40!llvm.dbg.cu = !{!0}41!llvm.module.flags = !{!2, !3, !4, !5, !1000}42!llvm.ident = !{!6}43 44!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 14.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)45!1 = !DIFile(filename: "test.cpp", directory: "/")46!2 = !{i32 7, !"Dwarf Version", i32 5}47!3 = !{i32 2, !"Debug Info Version", i32 3}48!4 = !{i32 1, !"wchar_size", i32 4}49!5 = !{i32 7, !"uwtable", i32 1}50!6 = !{!"clang version 14.0.0)"}51!7 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)52!8 = !DISubroutineType(types: !9)53!9 = !{!10, !10}54!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)55!11 = !{!12}56!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 1, type: !10)57!13 = distinct !DIAssignID()58!14 = !DILocation(line: 0, scope: !7)59!19 = distinct !DIAssignID()60!20 = !DILocation(line: 1, column: 23, scope: !7)61!21 = !DILocation(line: 1, column: 16, scope: !7)62!22 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 1, type: !10)63!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}64