brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · ae5f770 Raw
78 lines · plain
1; RUN: llc %s -start-after=codegenprepare -stop-before finalize-isel -o - \2; RUN:    -experimental-debug-variable-locations=false \3; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE4 5; RUN: llc %s -start-after=codegenprepare -stop-before finalize-isel -o - \6; RUN:    -experimental-debug-variable-locations=true \7; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF8 9; Adapted from sdag-transfer-dbgvalue.ll to test dbg.assign intrinsics. This10; ensures that dbg.assigns with no linked store are treated as dbg.values.11 12; This tests that transferDbgValues() changes order of SDDbgValue transferred13; to another node and debug info for 'ADD32ri' appears *after* the instruction.14;15; This test case was generated from the following program16; using: clang -g -O3 -S -emit-llvm test.c17;18; int foo(int a, int *b) {19;   int c = a + 512;20;   if (c != 0)21;     *b = a;22;   return c;23; }24 25target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"26target triple = "x86_64-unknown-linux-gnu"27 28; CHECK-LABEL: bb.0.entry:29; DBGVALUE:       %[[REG:[0-9]+]]:gr32 = ADD32ri %1, 51230; DBGVALUE-NEXT:  DBG_VALUE %[[REG]]31; INSTRREF:       ADD32ri %1, 512, {{.*}}debug-instr-number 132; INSTRREF-NEXT:  DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)33 34; Function Attrs: nofree norecurse nounwind uwtable writeonly35define dso_local i32 @foo(i32 %a, ptr nocapture %b) local_unnamed_addr !dbg !7 {36entry:37  %add = add nsw i32 %a, 512, !dbg !1838  call void @llvm.dbg.assign(metadata i32 %add, metadata !16, metadata !DIExpression(), metadata !19, metadata ptr undef, metadata !DIExpression()), !dbg !1739  %cmp = icmp eq i32 %add, 0, !dbg !1840  br i1 %cmp, label %if.end, label %if.then, !dbg !1841 42if.then:                                          ; preds = %entry43  store i32 %a, ptr %b, align 4, !dbg !1844  br label %if.end, !dbg !1845 46if.end:                                           ; preds = %entry, %if.then47  ret i32 %add, !dbg !1848}49 50; Function Attrs: nounwind readnone speculatable willreturn51declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)52 53!llvm.dbg.cu = !{!0}54!llvm.module.flags = !{!3, !4, !5, !1000}55!llvm.ident = !{!6}56 57!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)58!1 = !DIFile(filename: "test.c", directory: "/")59!2 = !{}60!3 = !{i32 2, !"Dwarf Version", i32 4}61!4 = !{i32 2, !"Debug Info Version", i32 3}62!5 = !{i32 1, !"wchar_size", i32 4}63!6 = !{!"clang version 10.0.0"}64!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)65!8 = !DIFile(filename: "test.c", directory: "/")66!9 = !DISubroutineType(types: !10)67!10 = !{!11, !11, !12}68!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)69!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)70!13 = !{!14, !15, !16}71!14 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !8, line: 1, type: !11)72!15 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !8, line: 1, type: !12)73!16 = !DILocalVariable(name: "c", scope: !7, file: !8, line: 2, type: !11)74!17 = !DILocation(line: 0, scope: !7)75!18 = !DILocation(line: 2, column: 13, scope: !7)76!19 = distinct !DIAssignID()77!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}78