[Bug rtl-optimization/109930] transform atomic exchange to unconditional store when old value is unused?
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon May 22 15:31:48 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109930
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |!i*86-* & !x86_64-*
Ever confirmed|0 |1
Last reconfirmed| |2023-05-22
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Severity|normal |enhancement
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Testcase:
```
#include <atomic>
std::atomic<uint32_t> x;
void f()
{
auto old_value = x.exchange(5);
(void)old_value;
}
void f0()
{
x = 5;
}
```
Note on x86_64, these produce the same code generation anyways.
Though on aarch64, it does produce different code.
I have a suspicion this was reported against x86_64 originally thinking these
two might produce different code generation ...
More information about the Gcc-bugs
mailing list