Files
clang-p2996/llvm/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp
Quentin Colombet 6b85fa6d81 [InstCombine] Don't optimize idempotent atomicrmw <op>, 0 into load atomic
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
2023-01-19 10:04:07 +01:00

5.1 KiB