https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85611
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |WAITING Last reconfirmed| |2018-05-03 Version|tree-ssa |7.3.1 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- So what do you expect? Elide the 2nd atomic load? We currently make no attempt at "optimizing" atomics on GIMPLE. OTOH run2 shows we do sth on RTL - ah, no. The testcase is just incomplete enough that the control statement is dead and the load is removed during RTL optimization.