http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672
--- Comment #4 from Vladimir Makarov <vmakarov at gcc dot gnu.org> 2012-12-17
21:39:28 UTC ---
If stack_realign_p is true, frame_pointer_needed is also true. So we can use
fp to eliminate frame but i386.c::x86_can_eliminate prohibits it. The code
looks strange:
if (stack_realign_fp)
return ((from == ARG_POINTER_REGNUM
&& to == HARD_FRAME_POINTER_REGNUM)
|| (from == FRAME_POINTER_REGNUM
&& to == STACK_POINTER_REGNUM));
So we permit to change argument pointer but not frame pointer to FP which again
is strange IMHO. Changing the code to
if (stack_realign_fp)
return ((from == ARG_POINTER_REGNUM
&& to == HARD_FRAME_POINTER_REGNUM)
|| (from == FRAME_POINTER_REGNUM
&& to == STACK_POINTER_REGNUM)
|| (from == FRAME_POINTER_REGNUM
&& to == HARD_FRAME_POINTER_REGNUM));
solves the problem.