https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108637
Li Shaohua <shaohua.li at inf dot ethz.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |--- Status|RESOLVED |UNCONFIRMED --- Comment #3 from Li Shaohua <shaohua.li at inf dot ethz.ch> --- (In reply to Li Shaohua from comment #2) > (In reply to Andrew Pinski from comment #1) > > PRE removes the load/stores from/to *f . > > Basically the compiler is able to remove the use-after-scope usage with -O2 > > and above. > > Well, this makes sense to me while in this case only -O2 not other opt > levels did not report this use-after-scope usage. I looked into this again and found that for GCC-12, it was indeed the case. But for the trunk, I indeed observed that PRE did not optimize away load/store. Compiler explorer: https://godbolt.org/z/sb658P1cM