Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10b64f2

Browse files
author
git apple-llvm automerger
committed
Merge commit '34e8f00066ee' from llvm.org/main into next
2 parents 3298482 + 34e8f00 commit 10b64f2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -5317,6 +5317,15 @@ struct AAAlignImpl : AAAlign {
53175317
InstrChanged = ChangeStatus::CHANGED;
53185318
}
53195319
}
5320+
} else if (auto *CAS = dyn_cast<AtomicCmpXchgInst>(U.getUser())) {
5321+
if (CAS->getPointerOperand() == &AssociatedValue) {
5322+
if (CAS->getAlign() < getAssumedAlign()) {
5323+
STATS_DECLTRACK(AAAlign, AtomicCmpXchg,
5324+
"Number of times alignment added to cmpxchg");
5325+
CAS->setAlignment(getAssumedAlign());
5326+
InstrChanged = ChangeStatus::CHANGED;
5327+
}
5328+
}
53205329
}
53215330
}
53225331

llvm/test/Transforms/Attributor/align-atomic.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ define ptr @atomicrmw_non_ptr_op_no_propagate(ptr %ptr, ptr align 16 %val) {
3737
define i32 @cmpxchg_propagate(ptr align 8 %ptr, i32 %cmp, i32 %val) {
3838
; CHECK-LABEL: define i32 @cmpxchg_propagate(
3939
; CHECK-SAME: ptr nofree noundef nonnull align 8 captures(none) dereferenceable(4) [[PTR:%.*]], i32 [[CMP:%.*]], i32 [[VAL:%.*]]) #[[ATTR0]] {
40-
; CHECK-NEXT: [[PAIR:%.*]] = cmpxchg ptr [[PTR]], i32 [[CMP]], i32 [[VAL]] seq_cst monotonic, align 2
40+
; CHECK-NEXT: [[PAIR:%.*]] = cmpxchg ptr [[PTR]], i32 [[CMP]], i32 [[VAL]] seq_cst monotonic, align 8
4141
; CHECK-NEXT: [[RESULT:%.*]] = extractvalue { i32, i1 } [[PAIR]], 0
4242
; CHECK-NEXT: ret i32 [[RESULT]]
4343
;

0 commit comments

Comments
 (0)