[bazel] Replace strip_include_prefix in lldb with includes (#125293)
[llvm-project.git] / llvm / test / DebugInfo / X86 / empty-line-info.ll
blob066dc5cc717c220f2743a3ef8923b6849c8b4e52
1 ; RUN: llc -O2 %s -o - -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=OPTS
2 ; RUN: llc -O0 %s -o - -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefix=UNOPT
4 ;; Test that, even though there are no source locations attached to the foo
5 ;; function, we still give it the start-of-function source location of the
6 ;; definition line. Otherwise, this function would have no entry in the
7 ;; line table at all.
9 ; OPTS-LABEL: foo:
10 ; OPTS-NEXT:   .Lfunc_begin0:
11 ; OPTS-NEXT:   .file   0 "." "foobar.c"
12 ; OPTS-NEXT:   .cfi_startproc
13 ; OPTS-NEXT:   # %bb.0:
14 ; OPTS-NEXT:   .loc    0 1 0 prologue_end
15 ; OPTS-LABEL: bar:
17 define dso_local noundef i32 @foo(ptr nocapture noundef writeonly %bar) local_unnamed_addr !dbg !10 {
18 entry:
19   store i32 0, ptr %bar, align 4
20   ret i32 0
23 ;; In a function with no source location, but multiple blocks, there will be
24 ;; an opening scope-line. Test for this behaviour, and preserve the
25 ;; unconditional branch by compiling -O0.
27 ; UNOPT-LABEL: bar:
28 ; UNOPT-NEXT:   .Lfunc_begin1:
29 ; UNOPT-NEXT:   .cfi_startproc
30 ; UNOPT-LABEL: %bb.0:
31 ; UNOPT-NEXT:   .loc    0 11 0 prologue_end
32 ; UNOPT-NEXT:    movq    %rdi, -8(%rsp)
33 ; UNOPT-NEXT:    jmp     .LBB1_1
34 ; UNOPT-LABEL: .LBB1_1:
35 ; UNOPT-NEXT:    movq    -8(%rsp), %rax
37 define dso_local noundef i32 @bar(ptr nocapture noundef writeonly %baz) local_unnamed_addr !dbg !20 {
38 entry:
39   br label %bb1
40 bb1:
41   store i32 0, ptr %baz, align 4
42   ret i32 0
45 !llvm.dbg.cu = !{!0}
46 !llvm.module.flags = !{!2, !3}
47 !llvm.ident = !{!9}
49 !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
50 !1 = !DIFile(filename: "foobar.c", directory: ".")
51 !2 = !{i32 7, !"Dwarf Version", i32 5}
52 !3 = !{i32 2, !"Debug Info Version", i32 3}
53 !9 = !{!"clang"}
54 !10 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !11, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
55 !11 = !DISubroutineType(types: !12)
56 !12 = !{!13, !14}
57 !13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
58 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64)
59 !15 = !{!16}
60 !16 = !DILocalVariable(name: "bar", arg: 1, scope: !10, file: !1, line: 1, type: !14)
61 !17 = !DILocation(line: 0, scope: !10)
62 !18 = !DILocation(line: 2, column: 8, scope: !10)
63 !20 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 11, type: !11, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !25)
64 !25 = !{!26}
65 !26 = !DILocalVariable(name: "bar", arg: 1, scope: !20, file: !1, line: 11, type: !14)
66 !27 = !DILocation(line: 0, scope: !20)
67 !28 = !DILocation(line: 12, column: 8, scope: !20)