------- Comment #23 from spark at gcc dot gnu dot org 2007-07-03 19:41 ------- This patch:
diff -r 29a7055e69fc gcc/df-scan.c --- a/gcc/df-scan.c Sun Jun 24 00:16:55 2007 +0000 +++ b/gcc/df-scan.c Tue Jul 03 12:38:41 2007 -0700 @@ -2763,6 +2763,12 @@ df_def_record_1 (struct df_collection_re || (GET_CODE (dst) == SUBREG && REG_P (SUBREG_REG (dst)))) df_ref_record (collection_rec, dst, loc, bb, insn, DF_REF_REG_DEF, flags); + + /* We want to keep sp alive everywhere - by making all + writes to sp also use of sp. */ + if (REG_P (dst) && REGNO (dst) == STACK_POINTER_REGNUM) + df_ref_record (collection_rec, + dst, NULL, bb, insn, DF_REF_REG_USE, flags); } also fixes the problem, by treating all defs of SP as a use of SP. This patch essentially makes SP alive everywhere. Also, this would create less number of unnecessary df_ref's (since presumably there are less number of stack defs than MEM_LOAD/STORE w/ hard frame pointer reference). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32475