xref: /aosp_15_r20/external/llvm/test/DebugInfo/Generic/nodebug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; Test that a nodebug function (a function not appearing in the debug info IR
6*9880d681SAndroid Build Coastguard Worker; metadata subprogram list) with DebugLocs on its IR doesn't cause crashes/does
7*9880d681SAndroid Build Coastguard Worker; the right thing.
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker; Build with clang from the following:
10*9880d681SAndroid Build Coastguard Worker; extern int i;
11*9880d681SAndroid Build Coastguard Worker; inline __attribute__((always_inline)) void f1() {
12*9880d681SAndroid Build Coastguard Worker;   i = 3;
13*9880d681SAndroid Build Coastguard Worker; }
14*9880d681SAndroid Build Coastguard Worker;
15*9880d681SAndroid Build Coastguard Worker; __attribute__((nodebug)) void f2() {
16*9880d681SAndroid Build Coastguard Worker;   f1();
17*9880d681SAndroid Build Coastguard Worker; }
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; Check that there's no DW_TAG_subprogram, not even for the 'f2' function.
20*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_compile_unit
21*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG_subprogram
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker@i = external global i32
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable
26*9880d681SAndroid Build Coastguard Workerdefine void @_Z2f2v() #0 {
27*9880d681SAndroid Build Coastguard Workerentry:
28*9880d681SAndroid Build Coastguard Worker  store i32 3, i32* @i, align 4, !dbg !11
29*9880d681SAndroid Build Coastguard Worker  ret void
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerattributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
35*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!8, !9}
36*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!10}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
39*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "nodebug.cpp", directory: "/tmp/dbginfo")
40*9880d681SAndroid Build Coastguard Worker!2 = !{}
41*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, variables: !2)
42*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "nodebug.cpp", directory: "/tmp/dbginfo")
43*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7)
44*9880d681SAndroid Build Coastguard Worker!7 = !{null}
45*9880d681SAndroid Build Coastguard Worker!8 = !{i32 2, !"Dwarf Version", i32 4}
46*9880d681SAndroid Build Coastguard Worker!9 = !{i32 2, !"Debug Info Version", i32 3}
47*9880d681SAndroid Build Coastguard Worker!10 = !{!"clang version 3.5.0 "}
48*9880d681SAndroid Build Coastguard Worker!11 = !DILocation(line: 3, scope: !4)
49