diff mbox

Create the *logue in the same order as before (PR77962)

Message ID a2fc09e43af8a6bdf16a98b86df7d301be977a9d.1476371494.git.segher@kernel.crashing.org
State New
Headers show

Commit Message

Segher Boessenkool Oct. 13, 2016, 3:15 p.m. UTC
PR77962 shows Go failing on 32-bit x86.  This happens because the i386
port requires the split stack prologue to be created before the normal
prologue, and my previous patch changed it to be the other way around.

This patch changes it back.  Things will be exactly as before for targets
that do not do shrink-wrapping for separate components.  For targets
that *do* support it, all three prologue/epilogue creation functions
will now be called twice for functions that have anything wrapped
separately (instead of just the prologue created twice).

Bootstrapping+testing on powerpc64-linux {-m64,-m32}, all languages;
and on x86_64-linux all,go,obj-c++ (i.e. no ada).

Is this okay for trunk if testing succeeds?  And sorry for the breakage.


Segher


2016-10-13  Segher Boessenkool  <segher@kernel.crashing.org>

	PR bootstrap/77962
	* function.c (thread_prologue_and_epilogue_insns): Call all
	make_*logue_seq in the same order as traditional.  Call them
	all a second time if shrink_wrapped-separate.

---
 gcc/function.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Comments

Segher Boessenkool Oct. 13, 2016, 4:43 p.m. UTC | #1
On Thu, Oct 13, 2016 at 03:15:37PM +0000, Segher Boessenkool wrote:
> Bootstrapping+testing on powerpc64-linux {-m64,-m32}, all languages;
> and on x86_64-linux all,go,obj-c++ (i.e. no ada).
> 
> Is this okay for trunk if testing succeeds?  And sorry for the breakage.

No new failures for either.


Segher
Jeff Law Oct. 13, 2016, 6:12 p.m. UTC | #2
On 10/13/2016 09:15 AM, Segher Boessenkool wrote:
> PR77962 shows Go failing on 32-bit x86.  This happens because the i386
> port requires the split stack prologue to be created before the normal
> prologue, and my previous patch changed it to be the other way around.
>
> This patch changes it back.  Things will be exactly as before for targets
> that do not do shrink-wrapping for separate components.  For targets
> that *do* support it, all three prologue/epilogue creation functions
> will now be called twice for functions that have anything wrapped
> separately (instead of just the prologue created twice).
>
> Bootstrapping+testing on powerpc64-linux {-m64,-m32}, all languages;
> and on x86_64-linux all,go,obj-c++ (i.e. no ada).
>
> Is this okay for trunk if testing succeeds?  And sorry for the breakage.
>
>
> Segher
>
>
> 2016-10-13  Segher Boessenkool  <segher@kernel.crashing.org>
>
> 	PR bootstrap/77962
> 	* function.c (thread_prologue_and_epilogue_insns): Call all
> 	make_*logue_seq in the same order as traditional.  Call them
> 	all a second time if shrink_wrapped-separate.
OK.
jeff
diff mbox

Patch

diff --git a/gcc/function.c b/gcc/function.c
index 5dafb8c..208f1a5 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5919,7 +5919,9 @@  thread_prologue_and_epilogue_insns (void)
   edge entry_edge = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun));
   edge orig_entry_edge = entry_edge;
 
+  rtx_insn *split_prologue_seq = make_split_prologue_seq ();
   rtx_insn *prologue_seq = make_prologue_seq ();
+  rtx_insn *epilogue_seq = make_epilogue_seq ();
 
   /* Try to perform a kind of shrink-wrapping, making sure the
      prologue/epilogue is emitted only around those parts of the
@@ -5931,13 +5933,17 @@  thread_prologue_and_epilogue_insns (void)
   try_shrink_wrapping_separate (entry_edge->dest);
 
   /* If that did anything for any component we now need the generate the
-     "main" prologue again.  If that does not work for some target then
-     that target should not enable separate shrink-wrapping.  */
+     "main" prologue again.  Because some targets require some of these
+     to be called in a specific order (i386 requires the split prologue
+     to be first, for example), we create all three sequences again here.
+     If this does not work for some target, that target should not enable
+     separate shrink-wrapping.  */
   if (crtl->shrink_wrapped_separate)
-    prologue_seq = make_prologue_seq ();
-
-  rtx_insn *split_prologue_seq = make_split_prologue_seq ();
-  rtx_insn *epilogue_seq = make_epilogue_seq ();
+    {
+      split_prologue_seq = make_split_prologue_seq ();
+      prologue_seq = make_prologue_seq ();
+      epilogue_seq = make_epilogue_seq ();
+    }
 
   rtl_profile_for_bb (EXIT_BLOCK_PTR_FOR_FN (cfun));