diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2020-07-07 09:54:13 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2020-07-07 09:54:13 +0000 |
commit | 74c723757e69fbe7d85e42527d07b728113699ae (patch) | |
tree | 8bcada75f6dfc652e6fa090318d67149bb282442 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 2cdf108d329bda280948ad634aa0a070337a5f88 (diff) | |
download | llvm-74c723757e69fbe7d85e42527d07b728113699ae.zip llvm-74c723757e69fbe7d85e42527d07b728113699ae.tar.gz llvm-74c723757e69fbe7d85e42527d07b728113699ae.tar.bz2 |
[NFC] Adding the align attribute on Atomic{CmpXchg|RMW}Inst
This is the first step to add support for the align attribute to AtomicRMWInst and AtomicCmpXchgInst.
Next step is to add support in IRBuilder and BitcodeReader.
Bug: https://bugs.llvm.org/show_bug.cgi?id=27168
Differential Revision: https://reviews.llvm.org/D83136
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 4471302..dceb492 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -5020,8 +5020,10 @@ Error BitcodeReader::parseFunctionBody(Function *F) { else FailureOrdering = getDecodedOrdering(Record[OpNum + 3]); - I = new AtomicCmpXchgInst(Ptr, Cmp, New, SuccessOrdering, FailureOrdering, - SSID); + Align Alignment( + TheModule->getDataLayout().getTypeStoreSize(Cmp->getType())); + I = new AtomicCmpXchgInst(Ptr, Cmp, New, Alignment, SuccessOrdering, + FailureOrdering, SSID); FullTy = StructType::get(Context, {FullTy, Type::getInt1Ty(Context)}); cast<AtomicCmpXchgInst>(I)->setVolatile(Record[OpNum]); @@ -5058,7 +5060,9 @@ Error BitcodeReader::parseFunctionBody(Function *F) { Ordering == AtomicOrdering::Unordered) return error("Invalid record"); SyncScope::ID SSID = getDecodedSyncScopeID(Record[OpNum + 3]); - I = new AtomicRMWInst(Operation, Ptr, Val, Ordering, SSID); + Align Alignment( + TheModule->getDataLayout().getTypeStoreSize(Val->getType())); + I = new AtomicRMWInst(Operation, Ptr, Val, Alignment, Ordering, SSID); FullTy = getPointerElementFlatType(FullTy); cast<AtomicRMWInst>(I)->setVolatile(Record[OpNum+1]); InstructionList.push_back(I); |