projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[ThinLTO] Check MDNode values saved for metadata linking (NFC)
[oota-llvm.git]
/
lib
/
Bitcode
/
Reader
/
BitcodeReader.cpp
diff --git
a/lib/Bitcode/Reader/BitcodeReader.cpp
b/lib/Bitcode/Reader/BitcodeReader.cpp
index 2e670d584ecc0c4cbf6c6c83b76afc3260523f86..824a3716b831ec679792d4a7f123bbd218202f02 100644
(file)
--- a/
lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/
lib/Bitcode/Reader/BitcodeReader.cpp
@@
-3071,7
+3071,12
@@
void BitcodeReader::saveMetadataList(
for (unsigned ID = 0; ID < MetadataList.size(); ++ID) {
Metadata *MD = MetadataList[ID];
auto *N = dyn_cast_or_null<MDNode>(MD);
for (unsigned ID = 0; ID < MetadataList.size(); ++ID) {
Metadata *MD = MetadataList[ID];
auto *N = dyn_cast_or_null<MDNode>(MD);
+ assert((!N || (N->isResolved() || N->isTemporary())) &&
+ "Found non-resolved non-temp MDNode while saving metadata");
// Save all values if !OnlyTempMD, otherwise just the temporary metadata.
// Save all values if !OnlyTempMD, otherwise just the temporary metadata.
+ // Note that in the !OnlyTempMD case we need to save all Metadata, not
+ // just MDNode, as we may have references to other types of module-level
+ // metadata (e.g. ValueAsMetadata) from instructions.
if (!OnlyTempMD || (N && N->isTemporary())) {
// Will call this after materializing each function, in order to
// handle remapping of the function's instructions/metadata.
if (!OnlyTempMD || (N && N->isTemporary())) {
// Will call this after materializing each function, in order to
// handle remapping of the function's instructions/metadata.