diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2020-06-30 09:54:45 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2020-06-30 09:54:45 +0000 |
commit | 2c5ff48e61b5611dee5696c103e654c98d7e43f1 (patch) | |
tree | ae0a021b51d4e2bf66fc74795c295eaf10b5dec9 /llvm/lib/IR/Instructions.cpp | |
parent | 621f84567920bf5a8d79789f01a622115ec8252d (diff) | |
download | llvm-2c5ff48e61b5611dee5696c103e654c98d7e43f1.zip llvm-2c5ff48e61b5611dee5696c103e654c98d7e43f1.tar.gz llvm-2c5ff48e61b5611dee5696c103e654c98d7e43f1.tar.bz2 |
[Alignment][NFC] Migrate AtomicExpandPass to Align
This is a followup on D78403.
I'm unsure about `getAtomicOpAlign` overloads that take `AtomicRMWInst` and `AtomicCmpXchgInst`, shouldn't `getAlign` provide the correct answer already?
Differential Revision: https://reviews.llvm.org/D81369
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 2087188..69a119b 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -1542,6 +1542,13 @@ AtomicCmpXchgInst::AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Init(Ptr, Cmp, NewVal, SuccessOrdering, FailureOrdering, SSID); } +Align AtomicCmpXchgInst::getAlign() const { + // The default here is to assume it has NATURAL alignment, not + // DataLayout-specified alignment. + const DataLayout &DL = getModule()->getDataLayout(); + return Align(DL.getTypeStoreSize(getCompareOperand()->getType())); +} + //===----------------------------------------------------------------------===// // AtomicRMWInst Implementation //===----------------------------------------------------------------------===// @@ -1623,6 +1630,13 @@ StringRef AtomicRMWInst::getOperationName(BinOp Op) { llvm_unreachable("invalid atomicrmw operation"); } +Align AtomicRMWInst::getAlign() const { + // The default here is to assume it has NATURAL alignment, not + // DataLayout-specified alignment. + const DataLayout &DL = getModule()->getDataLayout(); + return Align(DL.getTypeStoreSize(getValOperand()->getType())); +} + //===----------------------------------------------------------------------===// // FenceInst Implementation //===----------------------------------------------------------------------===// |