https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049
--- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Jonathan Yong <jy...@gcc.gnu.org>: https://gcc.gnu.org/g:2c5f48a43f26223cb8603b826d7c0d52cdbcfb46 commit r12-10625-g2c5f48a43f26223cb8603b826d7c0d52cdbcfb46 Author: LIU Hao <lh_mo...@126.com> Date: Mon Jul 15 16:55:52 2024 +0800 Do not use caller-saved registers for COMDAT functions A reference to a COMDAT function may be resolved to another definition outside the current translation unit, so it's not eligible for `-fipa-ra`. In `decl_binds_to_current_def_p()` there is already a check for weak symbols. This commit checks for COMDAT functions that are not implemented as weak symbols, for example, on *-*-mingw32. gcc/ChangeLog: PR rtl-optimization/115049 * varasm.cc (decl_binds_to_current_def_p): Add a check for COMDAT declarations too, like weak ones. (cherry picked from commit 5080840d8fbf25a321dd27543a1462d393d338bc)