xref: /llvm-project/llvm/test/DebugInfo/MIR/InstrRef/accept-nonlive-reg-phis.mir (revision d53425e2a33a0ff7336c86d3f668b1855c47a6de)
1# RUN: llc %s -verify-machineinstrs -o - -run-pass=livedebugvalues \
2# RUN:      -experimental-debug-variable-locations=true | FileCheck %s
3#
4# Test that we don't explode in a verifier error when we have a DBG_PHI of
5# a physreg that is not live. Doesn't matter what variable locations are
6# created.
7#
8# CHECK-NOT: Found {{.*}} machine code errors
9# CHECK: DBG_PHI $fp0
10# CHECK-NOT: Found {{.*}} machine code errors
11
12--- |
13  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
14  target triple = "x86_64-unknown-linux"
15
16  @b = dso_local local_unnamed_addr global i32 0, align 4, !dbg !0
17  @a = dso_local local_unnamed_addr global i32 0, align 4, !dbg !5
18
19  define dso_local i32 @c() local_unnamed_addr !dbg !13 {
20  entry:
21    ret i32 0, !dbg !36
22  }
23
24  declare void @llvm.dbg.declare(metadata, metadata, metadata)
25
26  declare void @llvm.dbg.value(metadata, metadata, metadata)
27
28  !llvm.dbg.cu = !{!2}
29  !llvm.module.flags = !{!8, !9, !10, !11}
30  !llvm.ident = !{!12}
31
32  !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
33  !1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)
34  !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 14.0.0 (git@github.com:llvm/llvm-project 1b09d0c42b42be219dd0984e0714d68b4a36cd3e)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
35  !3 = !DIFile(filename: "bbi-65026.c", directory: "/tmp")
36  !4 = !{!5, !0}
37  !5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
38  !6 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)
39  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
40  !8 = !{i32 7, !"Dwarf Version", i32 4}
41  !9 = !{i32 2, !"Debug Info Version", i32 3}
42  !10 = !{i32 1, !"wchar_size", i32 4}
43  !11 = !{i32 7, !"uwtable", i32 1}
44  !12 = !{!"clang version 14.0.0 (git@github.com:llvm/llvm-project 1b09d0c42b42be219dd0984e0714d68b4a36cd3e)"}
45  !13 = distinct !DISubprogram(name: "c", scope: !3, file: !3, line: 2, type: !14, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !16)
46  !14 = !DISubroutineType(types: !15)
47  !15 = !{!7}
48  !16 = !{!17}
49  !17 = !DILocalVariable(name: "d", scope: !13, file: !3, line: 3, type: !18)
50  !18 = !DIBasicType(name: "long double", size: 128, encoding: DW_ATE_float)
51  !19 = !DILocation(line: 3, column: 15, scope: !13)
52  !20 = !DILocation(line: 4, column: 7, scope: !21)
53  !21 = distinct !DILexicalBlock(scope: !13, file: !3, line: 4, column: 7)
54  !22 = !{!23, !23, i64 0}
55  !23 = !{!"int", !24, i64 0}
56  !24 = !{!"omnipotent char", !25, i64 0}
57  !25 = !{!"Simple C/C++ TBAA"}
58  !26 = !DILocation(line: 4, column: 9, scope: !21)
59  !27 = !DILocation(line: 0, scope: !21)
60  !28 = !DILocation(line: 4, column: 7, scope: !13)
61  !29 = !DILocation(line: 5, column: 9, scope: !21)
62  !30 = !DILocation(line: 0, scope: !13)
63  !31 = !DILocation(line: 5, column: 5, scope: !21)
64  !32 = !DILocation(line: 7, column: 11, scope: !21)
65  !33 = !DILocation(line: 7, column: 9, scope: !21)
66  !34 = !DILocation(line: 7, column: 15, scope: !21)
67  !35 = !DILocation(line: 8, column: 10, scope: !13)
68  !36 = !DILocation(line: 8, column: 3, scope: !13)
69
70...
71---
72name:            c
73alignment:       16
74tracksRegLiveness: true
75tracksDebugUserValues: true
76debugInstrRef: true
77frameInfo:
78  maxAlignment:    4
79machineFunctionInfo: {}
80body:             |
81  bb.0.entry:
82
83    DBG_PHI $fp0, 3
84    DBG_INSTR_REF !17, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(3, 0), debug-location !30
85    $eax = MOV32ri 0
86    RET 0, debug-location !36
87
88...
89