[PATCH] D141277: [InstCombine] Don't optimize idempotent `atomicrmw <op>, 0` into `load atomic`

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 06:44:32 PST 2023


qcolombet added a subscriber: RalfJung.
qcolombet added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp:135
     SI->setAlignment(DL.getABITypeAlign(RMWI.getType()));
     return eraseInstFromFunction(RMWI);
   }
----------------
nikic wrote:
> Just to double check, is this `atomicrmw` -> `store` fold fine, or does it also have a similar issue?
It might, but I'd like a "language lawyer" to confirm.

It took me some time to get convinced that this optimization is wrong to begin with so I would rather have an actual expert on the matter to comment :).

@RalfJung 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141277/new/

https://reviews.llvm.org/D141277



More information about the llvm-commits mailing list