https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90552
Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |easyhack --- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> --- This happens due to the following TODO from i386-options.c: /* TODO: ix86_cost should be chosen at instruction or function granuality so for cold code we use size_cost even in !optimize_size compilation. */ if (opts->x_optimize_size) ix86_cost = &ix86_size_cost; else ix86_cost = ix86_tune_cost; ix86_rtx_costs in i386.c is correctly called with speed=1, even when -Os is used. However, -Os switches ix86_cost to ix86_size_cost so the following line still returns ix86_size_cost: const struct processor_costs *cost = speed ? ix86_cost : &ix86_size_cost; So, someone should comb through i386*.c files and fix up ix86_cost usage to finally implement switching at insn/function "granuality" [sic]. Luckily, there are not that many instances in the code.