From 11aa3707e30fe2dae214e1299b951fe908def14c Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 14 May 2020 14:48:10 -0700 Subject: 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 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index c3c4996..64427b7 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; } -- cgit v1.1