https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86072
Phosit <phosit at autistici dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phosit at autistici dot org --- Comment #4 from Phosit <phosit at autistici dot org> --- (In reply to Richard Biener from comment #2) > Somebody has to decide if it's worth optimizing them and has to sit down and > exactly specify what kind of optimizations are valid. There is a paper about the optimization of atomics. It might not be detailed enough. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4455.html Note that the memory-model changed a bit since the release of that paper. > I guess it's worth optimizing them if these cases appear in real-world code > (and then we'd like to see examples). std::shared_ptr use fetch_add and fetch_sub. When a std::shared_ptr is not used for syncronization this optimization could take effect. PR 48987 is specifically about combining multiple fetch_add and fetch_sub.