[llvm] 6656171 - [Bitcode] Don't use UINT_MAX for missing SanitizerMetadata
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 10 18:23:02 PDT 2022
Author: Vitaly Buka
Date: 2022-06-10T18:20:55-07:00
New Revision: 665617182c453ec7fa088501fa37eb1ede8550f1
URL: https://github.com/llvm/llvm-project/commit/665617182c453ec7fa088501fa37eb1ede8550f1
DIFF: https://github.com/llvm/llvm-project/commit/665617182c453ec7fa088501fa37eb1ede8550f1.diff
LOG: [Bitcode] Don't use UINT_MAX for missing SanitizerMetadata
Looks like comment on D126100 was unnoticed.
Added:
Modified:
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index cd253c13e7b1e..b8d5faada7fc0 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3557,7 +3557,7 @@ Error BitcodeReader::parseGlobalVarRecord(ArrayRef<uint64_t> Record) {
if (Record.size() > 15)
NewGV->setPartition(StringRef(Strtab.data() + Record[14], Record[15]));
- if (Record.size() > 16 && Record[16] != UINT_MAX) {
+ if (Record.size() > 16 && Record[16]) {
llvm::GlobalValue::SanitizerMetadata Meta =
deserializeSanitizerMetadata(Record[16]);
NewGV->setSanitizerMetadata(Meta);
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 691b332a8be9a..a8a6b3f3a7dce 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1386,10 +1386,9 @@ void ModuleBitcodeWriter::writeModuleInfo() {
Vals.push_back(addToStrtab(GV.getPartition()));
Vals.push_back(GV.getPartition().size());
- if (GV.hasSanitizerMetadata())
- Vals.push_back(serializeSanitizerMetadata(GV.getSanitizerMetadata()));
- else
- Vals.push_back(UINT_MAX);
+ Vals.push_back((GV.hasSanitizerMetadata() ? serializeSanitizerMetadata(
+ GV.getSanitizerMetadata())
+ : 0));
} else {
AbbrevToUse = SimpleGVarAbbrev;
}
More information about the llvm-commits
mailing list