From patchwork Thu Oct 6 16:01:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Initial shrink-wrapping patch Date: Thu, 06 Oct 2011 06:01:39 -0000 From: Bernd Schmidt X-Patchwork-Id: 118119 Message-Id: <4E8DD0E3.5010106@codesourcery.com> To: Ian Lance Taylor Cc: Richard Henderson , Richard Guenther , GCC Patches , richard.sandiford@linaro.org On 10/06/11 17:57, Ian Lance Taylor wrote: > There is absolutely no reason to try to shrink wrap that code. It will > never help. That code always has to be first. It especially has to be > first because the gold linker recognizes the prologue specially when a > split-stack function calls a non-split-stack function, in order to > request a larger stack. Urgh, ok. > Therefore, it seems to me that we should apply shrink wrapping to the > function as it exists *before* the split-stack prologue is created. The > flag_split_stack bit should be moved after the flag_shrink_wrap bit. Sounds like we just need to always emit the split prologue on the original entry edge then. Can you test the following with Go? Bernd * function.c (thread_prologue_and_epilogue_insns): Emit split prologue on the orig_entry_edge. Don't account for it in prologue_clobbered. Index: gcc/function.c =================================================================== --- gcc/function.c (revision 179619) +++ gcc/function.c (working copy) @@ -5602,10 +5602,6 @@ thread_prologue_and_epilogue_insns (void note_stores (PATTERN (p_insn), record_hard_reg_sets, &prologue_clobbered); } - for (p_insn = split_prologue_seq; p_insn; p_insn = NEXT_INSN (p_insn)) - if (NONDEBUG_INSN_P (p_insn)) - note_stores (PATTERN (p_insn), record_hard_reg_sets, - &prologue_clobbered); bitmap_initialize (&bb_antic_flags, &bitmap_default_obstack); bitmap_initialize (&bb_on_list, &bitmap_default_obstack); @@ -5758,7 +5754,7 @@ thread_prologue_and_epilogue_insns (void if (split_prologue_seq != NULL_RTX) { - insert_insn_on_edge (split_prologue_seq, entry_edge); + insert_insn_on_edge (split_prologue_seq, orig_entry_edge); inserted = true; } if (prologue_seq != NULL_RTX)