aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2023-02-01 09:34:46 +0000
committerGuillaume Chatelet <gchatelet@google.com>2023-02-01 09:35:11 +0000
commit9e845fe44fa125c482178c2b626693e5d80851e0 (patch)
tree5965dc188c05c93d66af3d04b4151e0e6c95481f /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parentf559e781b2bd918d8cac8a878639870a8f26196d (diff)
downloadllvm-9e845fe44fa125c482178c2b626693e5d80851e0.zip
llvm-9e845fe44fa125c482178c2b626693e5d80851e0.tar.gz
llvm-9e845fe44fa125c482178c2b626693e5d80851e0.tar.bz2
[NFC] Use GlobalObject::setAlignment that takes an Align in BitcodeReader
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index f014521..30157af 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");