https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108229
Roger Sayle <roger at nextmovesoftware dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roger at nextmovesoftware dot com --- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> --- Created attachment 54159 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54159&action=edit compute_convert_gain patch I believe the attached patch should improve things, by tweaking the gains/costs used by the STV pass. Previously, GCC wasn't taking into account the conversion of memory references in operands of PLUS. In terms of u-ops/memory loads, the before and after in the bugzilla PR are pretty much equivalent, so the effect is subtle and probably depends on target microarchitecture. If folks could benchmark this change, and post the results I'd very much appreciate it. It would also be good to understand why/where this change was/is considered "unprofitable". The one thing I can guarantee is that with this proposed patch, GCC no longer increases function size with -Os [a tangible measure of unprofitable].