Skip to content

Commit 1e608f9

Browse files
committed
Revert "[DWARFv5] Verify all-or-nothing constraint on DIFile source"
This reverts commit 4ed5195. (cherry picked from commit 4e724c2)
1 parent b9d35f5 commit 1e608f9

File tree

3 files changed

+9
-86
lines changed

3 files changed

+9
-86
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
337337
NoConvergence
338338
} ConvergenceKind = NoConvergence;
339339

340-
/// Whether source was present on the first DIFile encountered in each CU.
341-
DenseMap<const DICompileUnit *, bool> HasSourceDebugInfo;
342-
343340
/// Stores the count of how many objects were passed to llvm.localescape for a
344341
/// given function and the largest index passed to llvm.localrecover.
345342
DenseMap<Function *, std::pair<unsigned, unsigned>> FrameEscapeInfo;
@@ -621,9 +618,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
621618
void verifyAttachedCallBundle(const CallBase &Call,
622619
const OperandBundleUse &BU);
623620

624-
/// Verify all-or-nothing property of DIFile source attribute within a CU.
625-
void verifySourceDebugInfo(const DICompileUnit &U, const DIFile &F);
626-
627621
/// Verify the llvm.experimental.noalias.scope.decl declarations
628622
void verifyNoAliasScopeDecl();
629623
};
@@ -1420,8 +1414,6 @@ void Verifier::visitDICompileUnit(const DICompileUnit &N) {
14201414

14211415
CurrentSourceLang = (dwarf::SourceLanguage)N.getSourceLanguage();
14221416

1423-
verifySourceDebugInfo(N, *N.getFile());
1424-
14251417
CheckDI((N.getEmissionKind() <= DICompileUnit::LastEmissionKind),
14261418
"invalid emission kind", &N);
14271419

@@ -1501,8 +1493,15 @@ void Verifier::visitDISubprogram(const DISubprogram &N) {
15011493
CheckDI(N.isDistinct(), "subprogram definitions must be distinct", &N);
15021494
CheckDI(Unit, "subprogram definitions must have a compile unit", &N);
15031495
CheckDI(isa<DICompileUnit>(Unit), "invalid unit type", &N, Unit);
1504-
if (N.getFile())
1505-
verifySourceDebugInfo(*N.getUnit(), *N.getFile());
1496+
// There's no good way to cross the CU boundary to insert a nested
1497+
// DISubprogram definition in one CU into a type defined in another CU.
1498+
auto *CT = dyn_cast_or_null<DICompositeType>(N.getRawScope());
1499+
if (CT && CT->getRawIdentifier() &&
1500+
M.getContext().isODRUniquingDebugTypes())
1501+
CheckDI(N.getDeclaration(),
1502+
"definition subprograms cannot be nested within DICompositeType "
1503+
"when enabling ODR",
1504+
&N);
15061505
} else {
15071506
// Subprogram declarations (part of the type hierarchy).
15081507
CheckDI(!Unit, "subprogram declarations must not have a compile unit", &N);
@@ -6697,14 +6696,6 @@ void Verifier::verifyAttachedCallBundle(const CallBase &Call,
66976696
}
66986697
}
66996698

6700-
void Verifier::verifySourceDebugInfo(const DICompileUnit &U, const DIFile &F) {
6701-
bool HasSource = F.getSource().has_value();
6702-
if (!HasSourceDebugInfo.count(&U))
6703-
HasSourceDebugInfo[&U] = HasSource;
6704-
CheckDI(HasSource == HasSourceDebugInfo[&U],
6705-
"inconsistent use of embedded source");
6706-
}
6707-
67086699
void Verifier::verifyNoAliasScopeDecl() {
67096700
if (NoAliasScopeDecls.empty())
67106701
return;

llvm/test/Assembler/debug-info-source-invalid.ll

Lines changed: 0 additions & 27 deletions
This file was deleted.

llvm/test/Assembler/debug-info-source.ll

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)