Add a parse-time check so that LLParser treats the `type:` field of
`DISubprogram` as required and non-null. Attempting to assemble IR with
a missing or null `type:` now produces a clear parse-time error
("missing required field 'type'" or "'type' cannot be null") rather
than relying solely on the verifier warning added in #194556.
Update existing hand-written LLVM IR tests to supply a minimal valid
`DISubroutineType` where they are not intentionally testing malformed
debug info.
**Scope.** This patch covers the LLParser path only. Two entry points
are intentionally deferred:
- *MetadataLoader*: pre-LLVM-5 bitcode legitimately stores null
`DISubprogram.type`; auto-upgrading that field requires more careful
backward-compatibility handling (see
`llvm/test/Bitcode/dityperefs-3.8.ll`).
- *BitcodeWriter*: IR written to bitcode has already passed the
verifier, which guarantees a non-null type; no additional check is
needed in the writer.
Follow-up to #194556.
23 lines
593 B
LLVM
23 lines
593 B
LLVM
; RUN: opt %s -passes=sample-profile -sample-profile-file=%S/Inputs/nodebug.prof
|
|
|
|
define void @foo() !dbg !3 {
|
|
call void @bar(), !dbg !4
|
|
ret void
|
|
}
|
|
|
|
define void @bar() {
|
|
call void @bar()
|
|
ret void
|
|
}
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!2}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
|
|
!1 = !DIFile(filename: "t", directory: "/tmp/")
|
|
!2 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!3 = distinct !DISubprogram(name: "a", scope: !1, file: !1, line: 10, unit: !0, type: !6)
|
|
!4 = !DILocation(line: 10, scope: !3)
|
|
!5 = !{null}
|
|
!6 = !DISubroutineType(types: !5)
|