llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-transforms Author: Matt Arsenault (arsenm) <details> <summary>Changes</summary> Fixes #<!-- -->134480 --- Full diff: https://github.com/llvm/llvm-project/pull/134838.diff 2 Files Affected: - (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+9) - (modified) llvm/test/Transforms/Attributor/align-atomic.ll (+1-1) ``````````diff diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 717ba7f688548..cc6e846f4f211 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -5317,6 +5317,15 @@ struct AAAlignImpl : AAAlign { InstrChanged = ChangeStatus::CHANGED; } } + } else if (auto *CAS = dyn_cast<AtomicCmpXchgInst>(U.getUser())) { + if (CAS->getPointerOperand() == &AssociatedValue) { + if (CAS->getAlign() < getAssumedAlign()) { + STATS_DECLTRACK(AAAlign, AtomicCmpXchg, + "Number of times alignment added to cmpxchg"); + CAS->setAlignment(getAssumedAlign()); + InstrChanged = ChangeStatus::CHANGED; + } + } } } diff --git a/llvm/test/Transforms/Attributor/align-atomic.ll b/llvm/test/Transforms/Attributor/align-atomic.ll index 0931c14685a87..0b363741cc168 100644 --- a/llvm/test/Transforms/Attributor/align-atomic.ll +++ b/llvm/test/Transforms/Attributor/align-atomic.ll @@ -37,7 +37,7 @@ define ptr @atomicrmw_non_ptr_op_no_propagate(ptr %ptr, ptr align 16 %val) { define i32 @cmpxchg_propagate(ptr align 8 %ptr, i32 %cmp, i32 %val) { ; CHECK-LABEL: define i32 @cmpxchg_propagate( ; CHECK-SAME: ptr nofree noundef nonnull align 8 captures(none) dereferenceable(4) [[PTR:%.*]], i32 [[CMP:%.*]], i32 [[VAL:%.*]]) #[[ATTR0]] { -; CHECK-NEXT: [[PAIR:%.*]] = cmpxchg ptr [[PTR]], i32 [[CMP]], i32 [[VAL]] seq_cst monotonic, align 2 +; CHECK-NEXT: [[PAIR:%.*]] = cmpxchg ptr [[PTR]], i32 [[CMP]], i32 [[VAL]] seq_cst monotonic, align 8 ; CHECK-NEXT: [[RESULT:%.*]] = extractvalue { i32, i1 } [[PAIR]], 0 ; CHECK-NEXT: ret i32 [[RESULT]] ; `````````` </details> https://github.com/llvm/llvm-project/pull/134838 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits