72 lines · plain
1; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \2; RUN: -experimental-debug-variable-locations=false \3; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE4; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \5; RUN: -experimental-debug-variable-locations=true \6; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF7 8; This tests that transferDbgValues() changes order of SDDbgValue transferred9; to another node and debug info for 'ADD32ri' appears *after* the instruction.10;11; This test case was generated from the following program12; using: clang -g -O3 -S -emit-llvm test.c13;14; int foo(int a, int *b) {15; int c = a + 512;16; if (c != 0)17; *b = a;18; return c;19; }20 21target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"22target triple = "x86_64-unknown-linux-gnu"23 24; CHECK-LABEL: bb.0.entry:25; CHECK: %[[REG:[0-9]+]]:gr32 = ADD32ri %1, 512,26; INSTRREF-SAME: debug-instr-number 127; INSTRREF-NEXT: DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)28; DBGVALUE-NEXT: DBG_VALUE %[[REG]]29 30; Function Attrs: nofree norecurse nounwind uwtable writeonly31define dso_local i32 @foo(i32 %a, ptr nocapture %b) local_unnamed_addr !dbg !7 {32entry:33 %add = add nsw i32 %a, 512, !dbg !1834 call void @llvm.dbg.value(metadata i32 %add, metadata !16, metadata !DIExpression()), !dbg !1735 %cmp = icmp eq i32 %add, 0, !dbg !1836 br i1 %cmp, label %if.end, label %if.then, !dbg !1837 38if.then: ; preds = %entry39 store i32 %a, ptr %b, align 4, !dbg !1840 br label %if.end, !dbg !1841 42if.end: ; preds = %entry, %if.then43 ret i32 %add, !dbg !1844}45 46; Function Attrs: nounwind readnone speculatable willreturn47declare void @llvm.dbg.value(metadata, metadata, metadata)48 49!llvm.dbg.cu = !{!0}50!llvm.module.flags = !{!3, !4, !5}51!llvm.ident = !{!6}52 53!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)54!1 = !DIFile(filename: "test.c", directory: "/")55!2 = !{}56!3 = !{i32 2, !"Dwarf Version", i32 4}57!4 = !{i32 2, !"Debug Info Version", i32 3}58!5 = !{i32 1, !"wchar_size", i32 4}59!6 = !{!"clang version 10.0.0"}60!7 = distinct !DISubprogram(name: "foo", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)61!8 = !DIFile(filename: "test.c", directory: "/")62!9 = !DISubroutineType(types: !10)63!10 = !{!11, !11, !12}64!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)65!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)66!13 = !{!14, !15, !16}67!14 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !8, line: 1, type: !11)68!15 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !8, line: 1, type: !12)69!16 = !DILocalVariable(name: "c", scope: !7, file: !8, line: 2, type: !11)70!17 = !DILocation(line: 0, scope: !7)71!18 = !DILocation(line: 2, column: 13, scope: !7)72