1 ; RUN: llc %s -stop-after=finalize-isel -o - \
5 ; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - \
8 ;; Same as diamond-1.ll except that the DIAssignID attached to the store has
9 ;; been deleted. In this case, we expect the same output as for diamond-1.ll
10 ;; because we choose to interpret stores to stack slots that don't link to
11 ;; debug intrinsics for a variable in the stack slot as a though they're linked
12 ;; to one placed immediately after.
21 ;; store (phi if.then: 100, if.else: 500)
24 ; CHECK-DAG: ![[VAR:[0-9]+]] = !DILocalVariable(name: "a",
27 ; CHECK: DBG_VALUE $edi, $noreg, ![[VAR]], !DIExpression()
29 ; CHECK: bb.1.if.then:
30 ; CHECK: DBG_VALUE 100, $noreg, ![[VAR]], !DIExpression()
32 ; CHECK: bb.2.if.else:
33 ; CHECK: DBG_VALUE 500, $noreg, ![[VAR]], !DIExpression()
36 ; CHECK-NEXT: %0:gr32 = PHI %2, %bb.1, %3, %bb.2
37 ; CHECK-NEXT: MOV32mr %stack.0.a.addr, 1, $noreg, 0, $noreg, %0
38 ; CHECK-NEXT: DBG_VALUE %stack.0.a.addr, $noreg, ![[VAR]], !DIExpression(DW_OP_deref)
40 target triple = "x86_64-unknown-linux-gnu"
42 ; Function Attrs: mustprogress uwtable
43 define dso_local noundef i32 @_Z1fi(i32 noundef %a) local_unnamed_addr #0 !dbg !7 {
45 %a.addr = alloca i32, align 4, !DIAssignID !13
46 call void @llvm.dbg.assign(metadata i1 undef, metadata !12, metadata !DIExpression(), metadata !13, metadata ptr %a.addr, metadata !DIExpression()), !dbg !14
47 call void @llvm.dbg.assign(metadata i32 %a, metadata !12, metadata !DIExpression(), metadata !15, metadata ptr %a.addr, metadata !DIExpression()), !dbg !14
48 %tobool.not = icmp eq i32 %a, 0, !dbg !16
49 br i1 %tobool.not, label %if.else, label %if.then, !dbg !18
51 if.then: ; preds = %entry
52 tail call void @_Z1ev(), !dbg !19
53 call void @llvm.dbg.assign(metadata i32 100, metadata !12, metadata !DIExpression(), metadata !21, metadata ptr %a.addr, metadata !DIExpression()), !dbg !14
54 br label %if.end, !dbg !22
56 if.else: ; preds = %entry
57 tail call void @_Z1dv(), !dbg !23
58 call void @llvm.dbg.assign(metadata i32 500, metadata !12, metadata !DIExpression(), metadata !21, metadata ptr %a.addr, metadata !DIExpression()), !dbg !14
61 if.end: ; preds = %if.else, %if.then
62 %storemerge = phi i32 [ 500, %if.else ], [ 100, %if.then ], !dbg !25
63 store i32 %storemerge, ptr %a.addr, align 4, !dbg !25
64 call void @_Z2esPi(ptr noundef nonnull %a.addr), !dbg !30
65 %0 = load i32, ptr %a.addr, align 4, !dbg !31
69 declare !dbg !33 dso_local void @_Z1ev() local_unnamed_addr #1
70 declare !dbg !37 dso_local void @_Z1dv() local_unnamed_addr #1
71 declare !dbg !38 dso_local void @_Z2esPi(ptr noundef) local_unnamed_addr #1
72 declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #2
75 !llvm.module.flags = !{!2, !3, !4, !5, !1000}
78 !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)
79 !1 = !DIFile(filename: "test.cpp", directory: "/")
80 !2 = !{i32 7, !"Dwarf Version", i32 5}
81 !3 = !{i32 2, !"Debug Info Version", i32 3}
82 !4 = !{i32 1, !"wchar_size", i32 4}
83 !5 = !{i32 7, !"uwtable", i32 1}
84 !6 = !{!"clang version 14.0.0"}
85 !7 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", scope: !1, file: !1, line: 4, type: !8, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
86 !8 = !DISubroutineType(types: !9)
88 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
90 !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 4, type: !10)
91 !13 = distinct !DIAssignID()
92 !14 = !DILocation(line: 0, scope: !7)
93 !15 = distinct !DIAssignID()
94 !16 = !DILocation(line: 5, column: 7, scope: !17)
95 !17 = distinct !DILexicalBlock(scope: !7, file: !1, line: 5, column: 7)
96 !18 = !DILocation(line: 5, column: 7, scope: !7)
97 !19 = !DILocation(line: 6, column: 5, scope: !20)
98 !20 = distinct !DILexicalBlock(scope: !17, file: !1, line: 5, column: 10)
99 !21 = distinct !DIAssignID()
100 !22 = !DILocation(line: 8, column: 3, scope: !20)
101 !23 = !DILocation(line: 9, column: 5, scope: !24)
102 !24 = distinct !DILexicalBlock(scope: !17, file: !1, line: 8, column: 10)
103 !25 = !DILocation(line: 0, scope: !17)
104 !30 = !DILocation(line: 12, column: 3, scope: !7)
105 !31 = !DILocation(line: 13, column: 10, scope: !7)
106 !32 = !DILocation(line: 13, column: 3, scope: !7)
107 !33 = !DISubprogram(name: "e", linkageName: "_Z1ev", scope: !1, file: !1, line: 2, type: !34, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !36)
108 !34 = !DISubroutineType(types: !35)
111 !37 = !DISubprogram(name: "d", linkageName: "_Z1dv", scope: !1, file: !1, line: 1, type: !34, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !36)
112 !38 = !DISubprogram(name: "es", linkageName: "_Z2esPi", scope: !1, file: !1, line: 3, type: !39, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !36)
113 !39 = !DISubroutineType(types: !40)
115 !41 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)
116 !1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}