[llvm] 5ececb4 - LowerAtomic: Use explicit alignment in lowerAtomicCmpXchgInst (#103767)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 06:04:17 PDT 2024
Author: Matt Arsenault
Date: 2024-08-14T17:04:13+04:00
New Revision: 5ececb4745a37f7b3dfade12e44e95c6b5e3c5bf
URL: https://github.com/llvm/llvm-project/commit/5ececb4745a37f7b3dfade12e44e95c6b5e3c5bf
DIFF: https://github.com/llvm/llvm-project/commit/5ececb4745a37f7b3dfade12e44e95c6b5e3c5bf.diff
LOG: LowerAtomic: Use explicit alignment in lowerAtomicCmpXchgInst (#103767)
Added:
Modified:
llvm/lib/Transforms/Utils/LowerAtomic.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/LowerAtomic.cpp b/llvm/lib/Transforms/Utils/LowerAtomic.cpp
index b203970ef9c5a..f9bf419fb0225 100644
--- a/llvm/lib/Transforms/Utils/LowerAtomic.cpp
+++ b/llvm/lib/Transforms/Utils/LowerAtomic.cpp
@@ -25,10 +25,11 @@ bool llvm::lowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI) {
Value *Cmp = CXI->getCompareOperand();
Value *Val = CXI->getNewValOperand();
- LoadInst *Orig = Builder.CreateLoad(Val->getType(), Ptr);
+ LoadInst *Orig =
+ Builder.CreateAlignedLoad(Val->getType(), Ptr, CXI->getAlign());
Value *Equal = Builder.CreateICmpEQ(Orig, Cmp);
Value *Res = Builder.CreateSelect(Equal, Val, Orig);
- Builder.CreateStore(Res, Ptr);
+ Builder.CreateAlignedStore(Res, Ptr, CXI->getAlign());
Res = Builder.CreateInsertValue(PoisonValue::get(CXI->getType()), Orig, 0);
Res = Builder.CreateInsertValue(Res, Equal, 1);
More information about the llvm-commits
mailing list