1; RUN: llc %s -stop-after=finalize-isel -o - | FileCheck %s --implicit-check-not=DBG_VALUE 2 3 4; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - | FileCheck %s --implicit-check-not=DBG_VALUE 5 6;; Check stores to an address computed as a negative offset from an alloca are 7;; ignored by the assignment tracking analysis. For this example that should 8;; result in no DBG_VALUEs in the while.body.lr.ph branch. 9;; 10;; See llvm.org/PR62838 for more info. 11;; 12;; $ clang test.c -O1 -g 13;; $ cat tes.c 14;; void a(int *p); 15;; __attribute__((nodebug)) int b; 16;; 17;; int main() { 18;; int c[1]; 19;; __attribute__((nodebug)) int d = -1; 20;; 21;; while (b) { 22;; c[0] = 0; 23;; c[d] = 0; 24;; } 25;; a(c); 26;; return 0; 27;; } 28 29; CHECK: bb.0.entry: 30; CHECK-NEXT: successors 31; CHECK-NEXT: {{^ *$}} 32; CHECK-NEXT: DBG_VALUE %stack.0.c, $noreg, ![[#]], !DIExpression(DW_OP_deref) 33 34; CHECK: bb.2.while.body: 35; CHECK-NEXT: successors 36; CHECK-NEXT: {{^ *$}} 37; CHECK-NEXT: DBG_VALUE 0, $noreg, ![[#]], !DIExpression() 38 39target triple = "x86_64-unknown-linux-gnu" 40 41@b = dso_local local_unnamed_addr global i32 0, align 4 42 43define dso_local i32 @main() local_unnamed_addr #0 !dbg !10 { 44entry: 45 %c = alloca [1 x i32], align 4, !DIAssignID !19 46 call void @llvm.dbg.assign(metadata i1 undef, metadata !15, metadata !DIExpression(), metadata !19, metadata ptr %c, metadata !DIExpression()), !dbg !20 47 %0 = load i32, ptr @b, align 4 48 %tobool.not = icmp eq i32 %0, 0 49 br i1 %tobool.not, label %while.end, label %while.body.lr.ph 50 51while.body.lr.ph: ; preds = %entry 52 %arrayidx1 = getelementptr inbounds [1 x i32], ptr %c, i64 0, i64 -1 53 store i32 0, ptr %arrayidx1, align 4 54 br label %while.body 55 56while.body: ; preds = %while.body, %while.body.lr.ph 57 call void @llvm.dbg.assign(metadata i32 0, metadata !15, metadata !DIExpression(), metadata !28, metadata ptr %c, metadata !DIExpression()), !dbg !20 58 br label %while.body 59 60while.end: ; preds = %entry 61 call void @a(ptr noundef nonnull %c) 62 ret i32 0 63} 64 65declare !dbg !31 void @a(ptr noundef) local_unnamed_addr #2 66declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #3 67 68!llvm.dbg.cu = !{!0} 69!llvm.module.flags = !{!2, !3, !8} 70!llvm.ident = !{!9} 71 72!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 17.0.0)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) 73!1 = !DIFile(filename: "test.c", directory: "/") 74!2 = !{i32 7, !"Dwarf Version", i32 5} 75!3 = !{i32 2, !"Debug Info Version", i32 3} 76!8 = !{i32 7, !"debug-info-assignment-tracking", i1 true} 77!9 = !{!"clang version 17.0.0"} 78!10 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14) 79!11 = !DISubroutineType(types: !12) 80!12 = !{!13} 81!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 82!14 = !{!15} 83!15 = !DILocalVariable(name: "c", scope: !10, file: !1, line: 5, type: !16) 84!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 32, elements: !17) 85!17 = !{!18} 86!18 = !DISubrange(count: 1) 87!19 = distinct !DIAssignID() 88!20 = !DILocation(line: 0, scope: !10) 89!28 = distinct !DIAssignID() 90!31 = !DISubprogram(name: "a", scope: !1, file: !1, line: 1, type: !32, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !35) 91!32 = !DISubroutineType(types: !33) 92!33 = !{null, !34} 93!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64) 94!35 = !{} 95