xref: /llvm-project/llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll (revision 133352feb30605ec51b15f77826ed3a2fbf8db56)
1; RUN: llc -O0 -dwarf-version=5 -debugger-tune=lldb -filetype=obj < %s \
2; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
3; RUN: llc -O0 -dwarf-version=5 -debugger-tune=gdb -filetype=obj < %s \
4; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
5; RUN: llc -force-instr-ref-livedebugvalues=1 -O0 -dwarf-version=5 -debugger-tune=lldb -filetype=obj < %s \
6; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
7; RUN: llc -force-instr-ref-livedebugvalues=1 -O0 -dwarf-version=5 -debugger-tune=gdb -filetype=obj < %s \
8; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
9
10; The call-site-params are created iff corresponding DISubprogram contains
11; the AllCallsDescribed DIFlag.
12; CHECK-NOT: DW_TAG_call_site_param
13
14; Genarated with:
15; clang -gdwarf-5 -O0 test.c -S -emit-llvm
16;
17; ModuleID = 'test.c'
18target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
19target triple = "x86_64-unknown-linux-gnu"
20
21; Function Attrs: noinline nounwind optnone uwtable
22define dso_local void @fn1(i32 %x, i32 %y) !dbg !7 {
23entry:
24  %x.addr = alloca i32, align 4
25  %y.addr = alloca i32, align 4
26  %u = alloca i32, align 4
27  %a = alloca i32, align 4
28  store i32 %x, ptr %x.addr, align 4
29  call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !11, metadata !DIExpression()), !dbg !12
30  store i32 %y, ptr %y.addr, align 4
31  call void @llvm.dbg.declare(metadata ptr %y.addr, metadata !13, metadata !DIExpression()), !dbg !14
32  call void @llvm.dbg.declare(metadata ptr %u, metadata !15, metadata !DIExpression()), !dbg !16
33  %0 = load i32, ptr %x.addr, align 4, !dbg !16
34  %1 = load i32, ptr %y.addr, align 4, !dbg !16
35  %add = add nsw i32 %0, %1, !dbg !16
36  store i32 %add, ptr %u, align 4, !dbg !16
37  %2 = load i32, ptr %x.addr, align 4, !dbg !17
38  %cmp = icmp sgt i32 %2, 1, !dbg !17
39  br i1 %cmp, label %if.then, label %if.else, !dbg !16
40
41if.then:                                          ; preds = %entry
42  %3 = load i32, ptr %u, align 4, !dbg !17
43  %add1 = add nsw i32 %3, 1, !dbg !17
44  store i32 %add1, ptr %u, align 4, !dbg !17
45  br label %if.end, !dbg !17
46
47if.else:                                          ; preds = %entry
48  %4 = load i32, ptr %u, align 4, !dbg !17
49  %add2 = add nsw i32 %4, 2, !dbg !17
50  store i32 %add2, ptr %u, align 4, !dbg !17
51  br label %if.end
52
53if.end:                                           ; preds = %if.else, %if.then
54  call void @llvm.dbg.declare(metadata ptr %a, metadata !19, metadata !DIExpression()), !dbg !16
55  store i32 7, ptr %a, align 4, !dbg !16
56  %5 = load i32, ptr %a, align 4, !dbg !16
57  call void @fn2(i32 %5), !dbg !16
58  %6 = load i32, ptr %u, align 4, !dbg !16
59  %dec = add nsw i32 %6, -1, !dbg !16
60  store i32 %dec, ptr %u, align 4, !dbg !16
61  ret void, !dbg !16
62}
63
64; Function Attrs: nounwind readnone speculatable willreturn
65declare void @llvm.dbg.declare(metadata, metadata, metadata)
66
67declare dso_local void @fn2(i32)
68
69!llvm.dbg.cu = !{!0}
70!llvm.module.flags = !{!3, !4, !5}
71!llvm.ident = !{!6}
72
73!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
74!1 = !DIFile(filename: "test.c", directory: "/")
75!2 = !{}
76!3 = !{i32 7, !"Dwarf Version", i32 5}
77!4 = !{i32 2, !"Debug Info Version", i32 3}
78!5 = !{i32 1, !"wchar_size", i32 4}
79!6 = !{!"clang version 11.0.0"}
80!7 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
81!8 = !DISubroutineType(types: !9)
82!9 = !{null, !10, !10}
83!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
84!11 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 5, type: !10)
85!12 = !DILocation(line: 5, column: 10, scope: !7)
86!13 = !DILocalVariable(name: "y", arg: 2, scope: !7, file: !1, line: 5, type: !10)
87!14 = !DILocation(line: 5, column: 17, scope: !7)
88!15 = !DILocalVariable(name: "u", scope: !7, file: !1, line: 6, type: !10)
89!16 = !DILocation(line: 6, column: 7, scope: !7)
90!17 = !DILocation(line: 7, column: 7, scope: !18)
91!18 = distinct !DILexicalBlock(scope: !7, file: !1, line: 7, column: 7)
92!19 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 11, type: !10)
93