This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Don't call dbr_schedule when -O0 -fdelayed-branch (PR rtl-optimization/38740)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Jan 2009 16:49:53 +0100
- Subject: [PATCH] Don't call dbr_schedule when -O0 -fdelayed-branch (PR rtl-optimization/38740)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The testcase in the PR is miscompiled when compiled with weirdo option
combination - -O0 -fdelayed-branch. The problem is that df_analyze
is only called after RA if optimize > 0 and dbr_schedule relies on the
dataflow info. While we could df_analyze at the end of the IRA pass
if (optimize || flag_delayed_branch) instead of just if (optimize),
I don't think it is worth supporting such weirdo option combination.
This patch instead doesn't dbr_schedule for -O0.
sh.c, the only other caller of dbr_schedule, already calls
it only if optimize > 0 && flag_delayed_branch.
Ok for trunk? No testcases that I see use -fdelayed-branch
and at -O0 flag_delayed_branch defaults to 0, so this patch shouldn't affect
bootstrap nor regtest on any target.
2009-01-28 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/38740
* reorg.c (gate_handle_delay_slots): Avoid dbr scheduling
if !optimize.
* config/mips/mips.c (mips_reorg): Likewise.
--- gcc/reorg.c.jj 2009-01-13 18:32:17.000000000 +0100
+++ gcc/reorg.c 2009-01-28 16:33:55.000000000 +0100
@@ -4046,7 +4046,8 @@ static bool
gate_handle_delay_slots (void)
{
#ifdef DELAY_SLOTS
- return flag_delayed_branch && !crtl->dbr_scheduled_p;
+ /* At -O0 dataflow info isn't updated after RA. */
+ return optimize > 0 && flag_delayed_branch && !crtl->dbr_scheduled_p;
#else
return 0;
#endif
--- gcc/config/mips/mips.c.jj 2009-01-13 18:32:17.000000000 +0100
+++ gcc/config/mips/mips.c 2009-01-28 16:32:47.000000000 +0100
@@ -13296,7 +13296,7 @@ mips_reorg (void)
mips16_lay_out_constants ();
if (mips_r10k_cache_barrier != R10K_CACHE_BARRIER_NONE)
r10k_insert_cache_barriers ();
- if (flag_delayed_branch)
+ if (optimize > 0 && flag_delayed_branch)
dbr_schedule (get_insns ());
mips_reorg_process_insns ();
if (!TARGET_MIPS16
Jakub