94 lines · plain
1; RUN: llc %s -stop-after=finalize-isel -o - | FileCheck %s --implicit-check-not=DBG_VALUE2 3 4 5;; Check stores to an address computed as a negative offset from an alloca are6;; ignored by the assignment tracking analysis. For this example that should7;; result in no DBG_VALUEs in the while.body.lr.ph branch.8;;9;; See llvm.org/PR62838 for more info.10;;11;; $ clang test.c -O1 -g12;; $ cat tes.c13;; void a(int *p);14;; __attribute__((nodebug)) int b;15;;16;; int main() {17;; int c[1];18;; __attribute__((nodebug)) int d = -1;19;;20;; while (b) {21;; c[0] = 0;22;; c[d] = 0;23;; }24;; a(c);25;; return 0;26;; }27 28; CHECK: bb.0.entry:29; CHECK-NEXT: successors30; CHECK-NEXT: {{^ *$}}31; CHECK-NEXT: DBG_VALUE %stack.0.c, $noreg, ![[#]], !DIExpression(DW_OP_deref)32 33; CHECK: bb.2.while.body:34; CHECK-NEXT: successors35; CHECK-NEXT: {{^ *$}}36; CHECK-NEXT: DBG_VALUE 0, $noreg, ![[#]], !DIExpression()37 38target triple = "x86_64-unknown-linux-gnu"39 40@b = dso_local local_unnamed_addr global i32 0, align 441 42define dso_local i32 @main() local_unnamed_addr #0 !dbg !10 {43entry:44 %c = alloca [1 x i32], align 4, !DIAssignID !1945 call void @llvm.dbg.assign(metadata i1 undef, metadata !15, metadata !DIExpression(), metadata !19, metadata ptr %c, metadata !DIExpression()), !dbg !2046 %0 = load i32, ptr @b, align 447 %tobool.not = icmp eq i32 %0, 048 br i1 %tobool.not, label %while.end, label %while.body.lr.ph49 50while.body.lr.ph: ; preds = %entry51 %arrayidx1 = getelementptr inbounds [1 x i32], ptr %c, i64 0, i64 -152 store i32 0, ptr %arrayidx1, align 453 br label %while.body54 55while.body: ; preds = %while.body, %while.body.lr.ph56 call void @llvm.dbg.assign(metadata i32 0, metadata !15, metadata !DIExpression(), metadata !28, metadata ptr %c, metadata !DIExpression()), !dbg !2057 br label %while.body58 59while.end: ; preds = %entry60 call void @a(ptr noundef nonnull %c)61 ret i32 062}63 64declare !dbg !31 void @a(ptr noundef) local_unnamed_addr #265declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #366 67!llvm.dbg.cu = !{!0}68!llvm.module.flags = !{!2, !3, !8}69!llvm.ident = !{!9}70 71!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)72!1 = !DIFile(filename: "test.c", directory: "/")73!2 = !{i32 7, !"Dwarf Version", i32 5}74!3 = !{i32 2, !"Debug Info Version", i32 3}75!8 = !{i32 7, !"debug-info-assignment-tracking", i1 true}76!9 = !{!"clang version 17.0.0"}77!10 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)78!11 = !DISubroutineType(types: !12)79!12 = !{!13}80!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)81!14 = !{!15}82!15 = !DILocalVariable(name: "c", scope: !10, file: !1, line: 5, type: !16)83!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 32, elements: !17)84!17 = !{!18}85!18 = !DISubrange(count: 1)86!19 = distinct !DIAssignID()87!20 = !DILocation(line: 0, scope: !10)88!28 = distinct !DIAssignID()89!31 = !DISubprogram(name: "a", scope: !1, file: !1, line: 1, type: !32, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !35)90!32 = !DISubroutineType(types: !33)91!33 = !{null, !34}92!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64)93!35 = !{}94