https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90405
--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> --- Author: rearnsha Date: Thu May 9 16:00:23 2019 New Revision: 271036 URL: https://gcc.gnu.org/viewcvs?rev=271036&root=gcc&view=rev Log: [arm] PR target/90405 fix regression for thumb1 with -mtpcs-leaf-frame -mtpcs-leaf-frame causes an APCS-style backtrace frame to be created on the stack. This should probably be deprecated, but it did reveal an issue with the patch I committed previously to improve the code generation when pushing high registers, in that thumb_find_work_register had a different idea as to which registers were available as scratch registers. The new code actually does a better job of finding a viable work register and doesn't rely so much on assumptions about the ABI, so it seems better to adapt thumb_find_work_register to the new approach. This way we can eliminate some rather crufty code. gcc: PR target/90405 * config/arm/arm.c (callee_saved_reg_p): Move before thumb_find_work_register. (thumb1_prologue_unused_call_clobbered_lo_regs): Move before thumb_find_work_register. Only call df_get_live_out once. (thumb1_epilogue_unused_call_clobbered_lo_regs): Likewise. (thumb_find_work_register): Use thumb1_prologue_unused_call_clobbered_lo_regs instead of ad hoc algorithms to locate a spare call clobbered reg. gcc/testsuite: PR target/90405 * gcc.target/arm/pr90405.c: New test. Modified: trunk/gcc/ChangeLog trunk/gcc/config/arm/arm.c