This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR 32475 stack setup code being deleted.


Attached is the patch to fix 32475
where the stack pointer becomes dead after epilogue generation,
due to the stack pointer restoration codein the epilogue.
The patch adds a df_ref of use of the stack pointer
for every write to the stack pointer - which essentially keeps
the stack pointer alive always.
Bootstrapped and regtested clean on x86-64.
Ok for mainline ?

2007-07-03 Seongbae Park <seongbae.park@gmail.com>

       PR rtl-optimization/32475
       * df-scan.c (df_def_record_1): Add a use of the stack pointer
       for every definition of the stack pointer.

--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com";
Index: gcc/df-scan.c
===================================================================
--- gcc/df-scan.c	(revision 126285)
+++ gcc/df-scan.c	(working copy)
@@ -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);
 }
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]