brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.9 KiB · 6209f81 Raw
109 lines · plain
1; RUN: llc %s -stop-before finalize-isel -o - \2; RUN:    -experimental-debug-variable-locations=false \3; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE --implicit-check-not="DBG_VALUE \$noreg"4 5; RUN: llc %s -stop-before finalize-isel -o - \6; RUN:    -experimental-debug-variable-locations=true \7; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF --implicit-check-not="DBG_VALUE \$noreg"8 9;; Found in the wild, but this test involves modifications from:10;; int b;11;; void ext();12;; int fun(int a) {13;;   if (b == 0)14;;     ext();15;;16;;   a += b;17;;   return a;18;; }19;; A `dbg.assign(undef, ...)` has been added by hand in if.end.20 21;; For some variable we generate:22;;     %inc = add nuw nsw i32 %i.0128, 123;;     call void @llvm.dbg.value(metadata i32 undef, ...24;;     call void @llvm.dbg.value(metadata i32 %inc, ...25;;26;; SelectionDAG swaps the dbg.value positions:27;;     %31:gr32 = nuw nsw ADD32ri8 %30:gr32(tied-def 0), 128;;     DBG_VALUE %31:gr32, ...29;;     DBG_VALUE $noreg, ...30;;31;; Make sure to avoid this by removing redundant dbg.values after lowering32;; dbg.assigns.33 34;; Check that there's a debug instruction (--implicit-check-not checks no35;; `DBG_VALUE $noreg, ...` has been added).36; CHECK: bb.2.if.end:37; DBGVALUE: DBG_VALUE38; INSTRREF: INSTR_REF39 40target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"41target triple = "x86_64-unknown-linux-gnu"42 43@b = dso_local local_unnamed_addr global i32 0, align 4, !dbg !044 45; Function Attrs: uwtable mustprogress46define dso_local i32 @_Z3funi(i32 %a) local_unnamed_addr #0 !dbg !11 {47entry:48  call void @llvm.dbg.assign(metadata i1 undef, metadata !15, metadata !DIExpression(), metadata !16, metadata ptr undef, metadata !DIExpression()), !dbg !1749  call void @llvm.dbg.assign(metadata i32 %a, metadata !15, metadata !DIExpression(), metadata !18, metadata ptr undef, metadata !DIExpression()), !dbg !1750  %0 = load i32, ptr @b, align 4, !dbg !1951  %cmp = icmp eq i32 %0, 0, !dbg !2552  br i1 %cmp, label %if.then, label %if.end, !dbg !2653 54if.then:                                          ; preds = %entry55  tail call void @_Z3extv(), !dbg !2756  %.pre = load i32, ptr @b, align 4, !dbg !2857  br label %if.end, !dbg !2758 59if.end:                                           ; preds = %if.then, %entry60  %1 = phi i32 [ %.pre, %if.then ], [ %0, %entry ], !dbg !2861  %add = add nsw i32 %1, %a, !dbg !2962  ;; Added by hand:63  call void @llvm.dbg.assign(metadata i32 undef, metadata !15, metadata !DIExpression(), metadata !30, metadata ptr undef, metadata !DIExpression()), !dbg !1764call void @llvm.dbg.assign(metadata i32 %add, metadata !15, metadata !DIExpression(), metadata !30, metadata ptr undef, metadata !DIExpression()), !dbg !1765  ret i32 %add, !dbg !3166}67 68declare !dbg !32 dso_local void @_Z3extv() local_unnamed_addr #169 70; Function Attrs: nofree nosync nounwind readnone speculatable willreturn71declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #272 73!llvm.dbg.cu = !{!2}74!llvm.module.flags = !{!7, !8, !9, !1000}75!llvm.ident = !{!10}76 77!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())78!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)79!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)80!3 = !DIFile(filename: "test.cpp", directory: "/")81!4 = !{}82!5 = !{!0}83!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)84!7 = !{i32 7, !"Dwarf Version", i32 4}85!8 = !{i32 2, !"Debug Info Version", i32 3}86!9 = !{i32 1, !"wchar_size", i32 4}87!10 = !{!"clang version 12.0.0"}88!11 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funi", scope: !3, file: !3, line: 3, type: !12, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !14)89!12 = !DISubroutineType(types: !13)90!13 = !{!6, !6}91!14 = !{!15}92!15 = !DILocalVariable(name: "a", arg: 1, scope: !11, file: !3, line: 3, type: !6)93!16 = distinct !DIAssignID()94!17 = !DILocation(line: 0, scope: !11)95!18 = distinct !DIAssignID()96!19 = !DILocation(line: 4, column: 7, scope: !20)97!20 = distinct !DILexicalBlock(scope: !11, file: !3, line: 4, column: 7)98!25 = !DILocation(line: 4, column: 9, scope: !20)99!26 = !DILocation(line: 4, column: 7, scope: !11)100!27 = !DILocation(line: 5, column: 5, scope: !20)101!28 = !DILocation(line: 7, column: 8, scope: !11)102!29 = !DILocation(line: 7, column: 5, scope: !11)103!30 = distinct !DIAssignID()104!31 = !DILocation(line: 8, column: 3, scope: !11)105!32 = !DISubprogram(name: "ext", linkageName: "_Z3extv", scope: !3, file: !3, line: 2, type: !33, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4)106!33 = !DISubroutineType(types: !34)107!34 = !{null}108!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}109