aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2021-11-09 14:23:04 -0800
committerArthur Eubanks <aeubanks@google.com>2021-11-09 14:27:55 -0800
commit05963a3d66047695aaabd47a161fced7687135db (patch)
treeac297edae6978c4badda5489f054f350e649f012 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent50082e1882ae7fe101e563c5e18a27e0804d517b (diff)
downloadllvm-05963a3d66047695aaabd47a161fced7687135db.zip
llvm-05963a3d66047695aaabd47a161fced7687135db.tar.gz
llvm-05963a3d66047695aaabd47a161fced7687135db.tar.bz2
Revert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"
This reverts commit ee7652569854af567ba83e5255d70e80cc8619a1. Causes crashes, see comments in D104827.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index a92c11e..fd77a8c 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1766,6 +1766,7 @@ void ModuleBitcodeWriter::writeDIFile(const DIFile *N,
void ModuleBitcodeWriter::writeDICompileUnit(const DICompileUnit *N,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
+ assert(N->isDistinct() && "Expected distinct compile units");
Record.push_back(/* IsDistinct */ true);
Record.push_back(N->getSourceLanguage());
Record.push_back(VE.getMetadataOrNullID(N->getFile()));
@@ -2019,7 +2020,7 @@ void ModuleBitcodeWriter::writeDIExpression(const DIExpression *N,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
Record.reserve(N->getElements().size() + 1);
- const uint64_t Version = 4 << 1;
+ const uint64_t Version = 3 << 1;
Record.push_back((uint64_t)N->isDistinct() | Version);
Record.append(N->elements_begin(), N->elements_end());
@@ -2165,20 +2166,6 @@ void ModuleBitcodeWriter::writeMetadataRecords(
if (const MDNode *N = dyn_cast<MDNode>(MD)) {
assert(N->isResolved() && "Expected forward references to be resolved");
-#ifndef NDEBUG
- switch (N->getMetadataID()) {
-#define HANDLE_MDNODE_LEAF_UNIQUED(CLASS) \
- case Metadata::CLASS##Kind: \
- assert(!N->isDistinct() && "Expected non-distinct " #CLASS); \
- break;
-#define HANDLE_MDNODE_LEAF_DISTINCT(CLASS) \
- case Metadata::CLASS##Kind: \
- assert(N->isDistinct() && "Expected distinct " #CLASS); \
- break;
-#include "llvm/IR/Metadata.def"
- }
-#endif
-
switch (N->getMetadataID()) {
default:
llvm_unreachable("Invalid MDNode subclass");