https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71709
--- Comment #8 from Alan Modra <amodra at gcc dot gnu.org> --- Author: amodra Date: Fri Jul 1 11:15:17 2016 New Revision: 237909 URL: https://gcc.gnu.org/viewcvs?rev=237909&root=gcc&view=rev Log: strcpy arg optimised out For functions that return an argument unchanged, like strcat, find_call_crossed_cheap_reg attempts to find an assignment between a pseudo reg and the arg reg before the call, so that uses of the pseudo after the call can instead use the return value. The exit condition on the loop looking at previous insns was wrong. Uses of the arg reg don't matter. What matters is the insn setting the arg reg as any assignment involving the arg reg prior to that insn is likely a completely unrelated use of the hard reg. PR rtl-optimization/71709 * ira-lives.c (find_call_crossed_cheap_reg): Exit loop on arg reg being set, not referenced. Modified: trunk/gcc/ChangeLog trunk/gcc/ira-lives.c