summaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@quicinc.com>2020-05-14 14:48:10 -0700
committerEli Friedman <efriedma@quicinc.com>2020-05-15 12:26:58 -0700
commit11aa3707e30fe2dae214e1299b951fe908def14c (patch)
tree879120ef8345106c82f0b14b2ddfc03e2aaeeb5f /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent18a855da431e74499695ce43a8db23a1755ba632 (diff)
StoreInst should store Align, not MaybeAlign
This is D77454, except for stores. All the infrastructure work was done for loads, so the remaining changes necessary are relatively small. Differential Revision: https://reviews.llvm.org/D79968
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index c3c49960a4fe..64427b75d5da 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -4922,7 +4922,9 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
MaybeAlign Align;
if (Error Err = parseAlignmentValue(Record[OpNum], Align))
return Err;
- I = new StoreInst(Val, Ptr, Record[OpNum + 1], Align);
+ if (!Align)
+ Align = TheModule->getDataLayout().getABITypeAlign(Val->getType());
+ I = new StoreInst(Val, Ptr, Record[OpNum + 1], *Align);
InstructionList.push_back(I);
break;
}
@@ -4955,7 +4957,9 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
MaybeAlign Align;
if (Error Err = parseAlignmentValue(Record[OpNum], Align))
return Err;
- I = new StoreInst(Val, Ptr, Record[OpNum + 1], Align, Ordering, SSID);
+ if (!Align)
+ return error("Alignment missing from atomic store");
+ I = new StoreInst(Val, Ptr, Record[OpNum + 1], *Align, Ordering, SSID);
InstructionList.push_back(I);
break;
}