[llvm] 4e724c2 - Revert "[DWARFv5] Verify all-or-nothing constraint on DIFile source"
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 15:09:41 PST 2023
Author: Adrian Prantl
Date: 2023-11-30T15:09:24-08:00
New Revision: 4e724c2a214cc62fd024237f0bdf903ed8fbf45b
URL: https://github.com/llvm/llvm-project/commit/4e724c2a214cc62fd024237f0bdf903ed8fbf45b
DIFF: https://github.com/llvm/llvm-project/commit/4e724c2a214cc62fd024237f0bdf903ed8fbf45b.diff
LOG: Revert "[DWARFv5] Verify all-or-nothing constraint on DIFile source"
This reverts commit 4ed5195712fd1f3f43e23678d8f666c47d1aa7d5.
Added:
Modified:
llvm/lib/IR/Verifier.cpp
Removed:
llvm/test/Assembler/debug-info-source-invalid.ll
llvm/test/Assembler/debug-info-source.ll
################################################################################
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 5560c037aa3ee6b..5f466581ea98095 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -329,9 +329,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
/// The current source language.
dwarf::SourceLanguage CurrentSourceLang = dwarf::DW_LANG_lo_user;
- /// Whether source was present on the first DIFile encountered in each CU.
- DenseMap<const DICompileUnit *, bool> HasSourceDebugInfo;
-
/// Stores the count of how many objects were passed to llvm.localescape for a
/// given function and the largest index passed to llvm.localrecover.
DenseMap<Function *, std::pair<unsigned, unsigned>> FrameEscapeInfo;
@@ -620,9 +617,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
void verifyAttachedCallBundle(const CallBase &Call,
const OperandBundleUse &BU);
- /// Verify all-or-nothing property of DIFile source attribute within a CU.
- void verifySourceDebugInfo(const DICompileUnit &U, const DIFile &F);
-
/// Verify the llvm.experimental.noalias.scope.decl declarations
void verifyNoAliasScopeDecl();
};
@@ -1352,8 +1346,6 @@ void Verifier::visitDICompileUnit(const DICompileUnit &N) {
CurrentSourceLang = (dwarf::SourceLanguage)N.getSourceLanguage();
- verifySourceDebugInfo(N, *N.getFile());
-
CheckDI((N.getEmissionKind() <= DICompileUnit::LastEmissionKind),
"invalid emission kind", &N);
@@ -1442,8 +1434,6 @@ void Verifier::visitDISubprogram(const DISubprogram &N) {
"definition subprograms cannot be nested within DICompositeType "
"when enabling ODR",
&N);
- if (N.getFile())
- verifySourceDebugInfo(*N.getUnit(), *N.getFile());
} else {
// Subprogram declarations (part of the type hierarchy).
CheckDI(!Unit, "subprogram declarations must not have a compile unit", &N);
@@ -6590,14 +6580,6 @@ void Verifier::verifyAttachedCallBundle(const CallBase &Call,
}
}
-void Verifier::verifySourceDebugInfo(const DICompileUnit &U, const DIFile &F) {
- bool HasSource = F.getSource().has_value();
- if (!HasSourceDebugInfo.count(&U))
- HasSourceDebugInfo[&U] = HasSource;
- CheckDI(HasSource == HasSourceDebugInfo[&U],
- "inconsistent use of embedded source");
-}
-
void Verifier::verifyNoAliasScopeDecl() {
if (NoAliasScopeDecls.empty())
return;
diff --git a/llvm/test/Assembler/debug-info-source-invalid.ll b/llvm/test/Assembler/debug-info-source-invalid.ll
deleted file mode 100644
index d746e9e25fc3d12..000000000000000
--- a/llvm/test/Assembler/debug-info-source-invalid.ll
+++ /dev/null
@@ -1,27 +0,0 @@
-; RUN: llvm-as < %s 2>&1 >/dev/null | FileCheck %s
-
-; Ensure we reject debug info where the DIFiles of a DICompileUnit mix source
-; and no-source.
-
-define dso_local void @foo() !dbg !5 {
- ret void
-}
-
-define dso_local void @bar() !dbg !6 {
- ret void
-}
-
-!llvm.dbg.cu = !{!4}
-!llvm.module.flags = !{!0, !1}
-
-!0 = !{i32 2, !"Dwarf Version", i32 5}
-!1 = !{i32 2, !"Debug Info Version", i32 3}
-
-!2 = !DIFile(filename: "foo.c", directory: "dir", source: "void foo() { }\0A")
-; CHECK: inconsistent use of embedded source
-; CHECK: warning: ignoring invalid debug info
-!3 = !DIFile(filename: "bar.h", directory: "dir")
-
-!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2)
-!5 = distinct !DISubprogram(name: "foo", file: !2, unit: !4)
-!6 = distinct !DISubprogram(name: "bar", file: !3, unit: !4)
diff --git a/llvm/test/Assembler/debug-info-source.ll b/llvm/test/Assembler/debug-info-source.ll
deleted file mode 100644
index 381603ef35c3839..000000000000000
--- a/llvm/test/Assembler/debug-info-source.ll
+++ /dev/null
@@ -1,41 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
-; RUN: verify-uselistorder %s
-
-; Ensure we accept debug info where DIFiles within a DICompileUnit either all
-; have source, or none have source.
-
-define dso_local void @foo() !dbg !6 {
- ret void
-}
-
-define dso_local void @bar() !dbg !7 {
- ret void
-}
-
-define dso_local void @baz() !dbg !9 {
- ret void
-}
-
-define dso_local void @qux() !dbg !11 {
- ret void
-}
-
-!llvm.dbg.cu = !{!0, !2}
-!llvm.module.flags = !{!4, !5}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
-; CHECK: !1 = !DIFile(filename: "foo.c", directory: "dir", source: "void foo() { }\0A")
-!1 = !DIFile(filename: "foo.c", directory: "dir", source: "void foo() { }\0A")
-!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3)
-; CHECK: !3 = !DIFile(filename: "qux.h", directory: "dir")
-!3 = !DIFile(filename: "qux.h", directory: "dir")
-!4 = !{i32 2, !"Dwarf Version", i32 5}
-!5 = !{i32 2, !"Debug Info Version", i32 3}
-!6 = distinct !DISubprogram(name: "foo", file: !1, unit: !0)
-!7 = distinct !DISubprogram(name: "bar", file: !8, unit: !0)
-; CHECK: !8 = !DIFile(filename: "bar.h", directory: "dir", source: "void bar() { }\0A")
-!8 = !DIFile(filename: "bar.h", directory: "dir", source: "void bar() { }\0A")
-!9 = distinct !DISubprogram(name: "baz", file: !10, unit: !2)
-; CHECK: !10 = !DIFile(filename: "baz.c", directory: "dir")
-!10 = !DIFile(filename: "baz.c", directory: "dir")
-!11 = distinct !DISubprogram(name: "qux", file: !3, unit: !2)
More information about the llvm-commits
mailing list