https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85509
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2018-04-24 CC| |hubicka at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Component|c++ |tree-optimization Summary|auto (function pointer) |fails to promote local |undermining inline |static to const |expansion with GCC but not | |LLVM | Ever confirmed|0 |1 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is you fail to make PerformQuickly and PerformSafely const and GCC doesn't have local analysis to promote it so and IPA analysis is too late for that since it is also the last inlining point. Slight complication is nested functions and OMP outlining which may refer to these variables. But even the initial cgraph build should be able to figure out the const-ness, no? Workaround: make the vars const.