@@ -5283,7 +5283,7 @@ struct AAAlignImpl : AAAlign {
5283
5283
5284
5284
// / See AbstractAttribute::manifest(...).
5285
5285
ChangeStatus manifest (Attributor &A) override {
5286
- ChangeStatus LoadStoreChanged = ChangeStatus::UNCHANGED;
5286
+ ChangeStatus InstrChanged = ChangeStatus::UNCHANGED;
5287
5287
5288
5288
// Check for users that allow alignment annotations.
5289
5289
Value &AssociatedValue = getAssociatedValue ();
@@ -5297,16 +5297,26 @@ struct AAAlignImpl : AAAlign {
5297
5297
STATS_DECLTRACK (AAAlign, Store,
5298
5298
" Number of times alignment added to a store" );
5299
5299
SI->setAlignment (getAssumedAlign ());
5300
- LoadStoreChanged = ChangeStatus::CHANGED;
5300
+ InstrChanged = ChangeStatus::CHANGED;
5301
5301
}
5302
5302
} else if (auto *LI = dyn_cast<LoadInst>(U.getUser ())) {
5303
5303
if (LI->getPointerOperand () == &AssociatedValue)
5304
5304
if (LI->getAlign () < getAssumedAlign ()) {
5305
5305
LI->setAlignment (getAssumedAlign ());
5306
5306
STATS_DECLTRACK (AAAlign, Load,
5307
5307
" Number of times alignment added to a load" );
5308
- LoadStoreChanged = ChangeStatus::CHANGED;
5308
+ InstrChanged = ChangeStatus::CHANGED;
5309
5309
}
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
+ }
5310
5320
}
5311
5321
}
5312
5322
@@ -5315,8 +5325,8 @@ struct AAAlignImpl : AAAlign {
5315
5325
Align InheritAlign =
5316
5326
getAssociatedValue ().getPointerAlignment (A.getDataLayout ());
5317
5327
if (InheritAlign >= getAssumedAlign ())
5318
- return LoadStoreChanged ;
5319
- return Changed | LoadStoreChanged ;
5328
+ return InstrChanged ;
5329
+ return Changed | InstrChanged ;
5320
5330
}
5321
5331
5322
5332
// TODO: Provide a helper to determine the implied ABI alignment and check in
0 commit comments