https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85961
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jsm28 at gcc dot gnu.org, | |rguenth at gcc dot gnu.org --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Alexander Monakov from comment #3) > You'd need to disable IPA-RA after forcing -O2 with the pragma, i.e.: > > #pragma GCC optimize "O2" > #pragma GCC optimize "no-ipa-ra" > > We already have logic to disable IPA-RA when instrumentation/profiling is > active, but it's done once in toplev.c. Here the pragma re-enables IPA-RA > after toplev.c:process_options() has disabled it. > > Do we want to adjust it given that "pragma optimized" is documented as "not > suitable for production use"? Hmm, given that -pg -O2 on the command-line doesn't get you IPA-RA enabled I would argue that the #pragma optimize behavior is bogus ... The issue here is that all "special" processing in toplev.c is lost. I'm not sure why we do all this in process_options () rather than in finish_options () because that is called again after applying optimize options AFAICS. So - all process_options () option post-processing should go away and be moved to finish_options ()? Note that process_options () is only called from do_compile and we do the postprocessing after lang_hooks.post_options which is applied only after finish_options () post-processing...