Orlando Cazalet-Hyams 140e1894f2
[KeyInstr] Add DISubprogram::keyInstructions bit (#144107)
Patch 1/4 adding bitcode support.

Store whether or not a function is using Key Instructions in its DISubprogram so
that we don't need to rely on the -mllvm flag -dwarf-use-key-instructions to
determine whether or not to interpret Key Instructions metadata to decide
is_stmt placement at DWARF emission time. This makes bitcode support simple and
enables well defined mixing of non-key-instructions and key-instructions
functions in an LTO context.

This patch adds the bit (using DISubprogram::SubclassData1).

PR 144104 and 144103 use it during DWARF emission.
PR 44102 adds bitcode
support.

See pull request for overview of alternative attempts.
2025-06-30 08:01:55 +01:00

21 lines
953 B
LLVM

; RUN: opt %s -o - -S| FileCheck %s
; CHECK: distinct !DISubprogram(name: "f", {{.*}}keyInstructions: true)
; CHECK: !DILocation(line: 1, column: 11, scope: ![[#]], atomGroup: 1, atomRank: 1)
define dso_local void @f() !dbg !10 {
entry:
ret void, !dbg !13
}
!llvm.module.flags = !{!3}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 21.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!3 = !{i32 2, !"Debug Info Version", i32 3}
!9 = !{!"clang version 21.0.0git"}
!10 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !11, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, keyInstructions: true)
!11 = !DISubroutineType(types: !12)
!12 = !{null}
!13 = !DILocation(line: 1, column: 11, scope: !10, atomGroup: 1, atomRank: 1)