Skip to content

Commit

Permalink
[Bitcode] Don't use UINT_MAX for missing SanitizerMetadata
Browse files Browse the repository at this point in the history
Looks like comment on D126100 was unnoticed.
  • Loading branch information
vitalybuka committed Jun 11, 2022
1 parent ee89927 commit 6656171
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6656171

Please sign in to comment.