@@ -5283,7 +5283,7 @@ struct AAAlignImpl : AAAlign {
52835283
52845284 // / See AbstractAttribute::manifest(...).
52855285 ChangeStatus manifest (Attributor &A) override {
5286- ChangeStatus LoadStoreChanged = ChangeStatus::UNCHANGED;
5286+ ChangeStatus InstrChanged = ChangeStatus::UNCHANGED;
52875287
52885288 // Check for users that allow alignment annotations.
52895289 Value &AssociatedValue = getAssociatedValue ();
@@ -5297,16 +5297,26 @@ struct AAAlignImpl : AAAlign {
52975297 STATS_DECLTRACK (AAAlign, Store,
52985298 " Number of times alignment added to a store" );
52995299 SI->setAlignment (getAssumedAlign ());
5300- LoadStoreChanged = ChangeStatus::CHANGED;
5300+ InstrChanged = ChangeStatus::CHANGED;
53015301 }
53025302 } else if (auto *LI = dyn_cast<LoadInst>(U.getUser ())) {
53035303 if (LI->getPointerOperand () == &AssociatedValue)
53045304 if (LI->getAlign () < getAssumedAlign ()) {
53055305 LI->setAlignment (getAssumedAlign ());
53065306 STATS_DECLTRACK (AAAlign, Load,
53075307 " Number of times alignment added to a load" );
5308- LoadStoreChanged = ChangeStatus::CHANGED;
5308+ InstrChanged = ChangeStatus::CHANGED;
53095309 }
5310+ } else if (auto *RMW = dyn_cast<AtomicRMWInst>(U.getUser ())) {
5311+ if (RMW->getPointerOperand () == &AssociatedValue) {
5312+ if (RMW->getAlign () < getAssumedAlign ()) {
5313+ STATS_DECLTRACK (AAAlign, AtomicRMW,
5314+ " Number of times alignment added to atomicrmw" );
5315+
5316+ RMW->setAlignment (getAssumedAlign ());
5317+ InstrChanged = ChangeStatus::CHANGED;
5318+ }
5319+ }
53105320 }
53115321 }
53125322
@@ -5315,8 +5325,8 @@ struct AAAlignImpl : AAAlign {
53155325 Align InheritAlign =
53165326 getAssociatedValue ().getPointerAlignment (A.getDataLayout ());
53175327 if (InheritAlign >= getAssumedAlign ())
5318- return LoadStoreChanged ;
5319- return Changed | LoadStoreChanged ;
5328+ return InstrChanged ;
5329+ return Changed | InstrChanged ;
53205330 }
53215331
53225332 // TODO: Provide a helper to determine the implied ABI alignment and check in
0 commit comments