[llvm] 9e845fe - [NFC] Use GlobalObject::setAlignment that takes an Align in BitcodeReader
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 1 01:35:23 PST 2023
Author: Guillaume Chatelet
Date: 2023-02-01T09:35:11Z
New Revision: 9e845fe44fa125c482178c2b626693e5d80851e0
URL: https://github.com/llvm/llvm-project/commit/9e845fe44fa125c482178c2b626693e5d80851e0
DIFF: https://github.com/llvm/llvm-project/commit/9e845fe44fa125c482178c2b626693e5d80851e0.diff
LOG: [NFC] Use GlobalObject::setAlignment that takes an Align in BitcodeReader
Added:
Modified:
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index f014521264c18..30157af91dcab 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3868,7 +3868,8 @@ Error BitcodeReader::parseGlobalVarRecord(ArrayRef<uint64_t> Record) {
GlobalVariable *NewGV =
new GlobalVariable(*TheModule, Ty, isConstant, Linkage, nullptr, Name,
nullptr, TLM, AddressSpace, ExternallyInitialized);
- NewGV->setAlignment(Alignment);
+ if (Alignment)
+ NewGV->setAlignment(*Alignment);
if (!Section.empty())
NewGV->setSection(Section);
NewGV->setVisibility(Visibility);
@@ -4027,7 +4028,8 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
MaybeAlign Alignment;
if (Error Err = parseAlignmentValue(Record[5], Alignment))
return Err;
- Func->setAlignment(Alignment);
+ if (Alignment)
+ Func->setAlignment(*Alignment);
if (Record[6]) {
if (Record[6] - 1 >= SectionTable.size())
return error("Invalid ID");
More information about the llvm-commits
mailing list