https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114232
--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Uroš Bizjak from comment #19) > (In reply to Jan Hubicka from comment #18) > > But the problem here is more that optab initializations happens only at > > the optimization_node changes and not if we switch from hot function to > > cold? > > I think solving optab init problem is a better solution than the target > patch from comment #10. Using optimize_function_for_size_p in named pattern > predicate would avoid using the non-optimal pattern also in cold functions, > and would be preferrable to using optimize_size. It would be very costly IMHO, because on every set_cfun we'd need to compute optimize_function_for_size_p for both the old and new function and find out where to attach the additional optab tables. set_cfun can be called millions of times.