xref: /llvm-project/llvm/test/DebugInfo/X86/instr-ref-flag.ll (revision 133352feb30605ec51b15f77826ed3a2fbf8db56)
1; RUN: llc %s -o - -stop-before=finalize-isel \
2; RUN: | FileCheck %s --check-prefixes=INSTRREFON
3; RUN: llc %s -o - -stop-before=finalize-isel \
4; RUN:    -experimental-debug-variable-locations=true \
5; RUN: | FileCheck %s --check-prefixes=INSTRREFON
6
7; RUN: llc %s -o - -stop-before=finalize-isel \
8; RUN:    -experimental-debug-variable-locations=false \
9; RUN: | FileCheck %s --check-prefixes=INSTRREFOFF \
10; RUN:    --implicit-check-not=DBG_INSTR_REF
11
12;; This test checks that for an x86 triple, instruction referencing is used
13;; by llc by default, and that it can be turned explicitly on or off as
14;; desired.
15
16; INSTRREFON: debugInstrRef: true
17; INSTRREFON: DBG_INSTR_REF
18; INSTRREFOFF: debugInstrRef: false
19; INSTRREFOFF: DBG_VALUE
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-unknown"
23
24define hidden i32 @foo(i32 %a) local_unnamed_addr !dbg !7 {
25  %b = add i32 %a, 1
26  call void @llvm.dbg.value(metadata i32 %b, metadata !11, metadata !DIExpression()), !dbg !12
27  ret i32 %b, !dbg !12
28}
29
30; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
31declare void @llvm.dbg.value(metadata, metadata, metadata)
32
33!llvm.dbg.cu = !{!0}
34!llvm.module.flags = !{!3, !4, !5, !6}
35
36!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
37!1 = !DIFile(filename: "foo.cpp", directory: ".")
38!2 = !DIBasicType(name: "int", size: 8, encoding: DW_ATE_signed)
39!3 = !{i32 2, !"Dwarf Version", i32 4}
40!4 = !{i32 2, !"Debug Info Version", i32 3}
41!5 = !{i32 1, !"wchar_size", i32 2}
42!6 = !{i32 7, !"PIC Level", i32 2}
43!7 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
44!8 = !DISubroutineType(types: !9)
45!9 = !{!2, !2}
46!10 = !{!11}
47!11 = !DILocalVariable(name: "baz", scope: !7, file: !1, line: 7, type: !2)
48!12 = !DILocation(line: 10, scope: !7)
49