Turning idempotent `atomicrmw`s into `load atomic` is perfectly legal with respect to how the loading happens, but it may not be legal for the whole program semantic. Indeed, this optimization removes a store that may have some effects on the legality of other optimizations. Essentially, we lose some information and depending on the backend it may or may not produce incorrect code, so don't do it! This fixes llvm.org/PR56450. Differential Revision: https://reviews.llvm.org/D141277
5.1 KiB
5.1 KiB