xref: /llvm-project/llvm/test/DebugInfo/AArch64/instr-ref-const-physreg.ll (revision d53425e2a33a0ff7336c86d3f668b1855c47a6de)
1; RUN: llc %s -stop-before=finalize-isel -mtriple=aarch64 -o - \
2; RUN:     -experimental-debug-variable-locations | FileCheck %s
3
4; Test that when an SSA Value becomes a constant-physreg copy, under the
5; instruction referencing model, the COPY is labelled. In the general case
6; labelling a copy is undesirable -- this test really checks that we don't
7; crash, and we don't just drop the information.
8
9; CHECK: DBG_PHI $xzr, 1
10; CHECK: DBG_INSTR_REF {{.+}}, dbg-instr-ref(1, 0)
11
12define i64 @test() !dbg !7 {
13  %foo = add i64 0, 0
14  call void @llvm.dbg.value(metadata i64 %foo, metadata !12, metadata !DIExpression()), !dbg !13
15  ret i64 %foo, !dbg !13
16}
17
18declare void @llvm.dbg.value(metadata, metadata, metadata)
19
20!llvm.dbg.cu = !{!0}
21!llvm.module.flags = !{!3, !4, !5}
22!llvm.ident = !{!6}
23
24!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
25!1 = !DIFile(filename: "test.c", directory: "/tmp/out.c")
26!2 = !{}
27!3 = !{i32 7, !"Dwarf Version", i32 4}
28!4 = !{i32 2, !"Debug Info Version", i32 3}
29!5 = !{i32 1, !"wchar_size", i32 4}
30!6 = !{!""}
31!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
32!8 = !DISubroutineType(types: !9)
33!9 = !{!10, !11, !11}
34!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
35!11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
36!12 = !DILocalVariable(name: "bar", arg: 1, scope: !7, file: !1, line: 3, type: !11)
37!13 = !DILocation(line: 0, scope: !7)
38!14 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)
39