From 0a2ed1f101ae61e97e3e652dde6a537ecb4a267c Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 22 Mar 2002 12:11:21 +0100 Subject: [PATCH] cfgcleanup.c (outgoing_edges_math): Fix condition; relax frequencies match; avoid match on different loop depths. * cfgcleanup.c (outgoing_edges_math): Fix condition; relax frequencies match; avoid match on different loop depths. (try_crossjump_to_bb): Kill tests that no longer brings time savings. * cfgrtl.c (force_nonfallthru_and_redirect): Fix loop_depth updating code. (split_edge): Likewise. * flow.c (update_life_info_in_dirty_blocks): Fix uninitialized variable. * Makefile.in (cfgrtl): Add insn-config.h depenendency. * cfgrtl.c: Include insn-config.h (split_block) Dirtify block in presence of conditional execution From-SVN: r51168 --- gcc/ChangeLog | 17 +++++++++++++++++ gcc/Makefile.in | 2 +- gcc/cfgcleanup.c | 22 +++++++++++++++++----- gcc/cfgrtl.c | 10 ++++++++++ gcc/flow.c | 6 +++--- 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eadd6073530..8a3de753a4d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +Fri Mar 22 12:08:36 CET 2002 Jan Hubicka + + * cfgcleanup.c (outgoing_edges_math): Fix condition; relax + frequencies match; avoid match on different loop depths. + (try_crossjump_to_bb): Kill tests that no longer brings time + savings. + * cfgrtl.c (force_nonfallthru_and_redirect): Fix loop_depth + updating code. + (split_edge): Likewise. + + * flow.c (update_life_info_in_dirty_blocks): Fix uninitialized + variable. + + * Makefile.in (cfgrtl): Add insn-config.h depenendency. + * cfgrtl.c: Include insn-config.h + (split_block) Dirtify block in presence of conditional execution + 2002-03-22 Richard Sandiford * config/mips/abi64.h (SETUP_INCOMING_VARARGS): Undefine. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 1b2e215f43e..462e20e4c68 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1494,7 +1494,7 @@ cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \ function.h except.h $(GGC_H) $(TM_P_H) cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \ $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ - function.h except.h $(GGC_H) $(TM_P_H) + function.h except.h $(GGC_H) $(TM_P_H) insn-config.h cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(BASIC_BLOCK_H) \ hard-reg-set.h insn-config.h $(RECOG_H) $(GGC_H) $(TM_P_H) cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h insn-config.h \ diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 078b669f3c0..bc637e4ee48 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1116,9 +1116,20 @@ outgoing_edges_match (mode, bb1, bb2) if (!bb2->succ || !bb2->succ->succ_next - || bb1->succ->succ_next->succ_next + || bb2->succ->succ_next->succ_next || !any_condjump_p (bb2->end) - || !onlyjump_p (bb1->end)) + || !onlyjump_p (bb2->end)) + return false; + + /* Do not crossjump across loop boundaries. This is a temporary + workaround for the common scenario in which crossjumping results + in killing the duplicated loop condition, making bb-reorder rotate + the loop incorectly, leaving an extra unconditional jump inside + the loop. + + This check should go away once bb-reorder knows how to duplicate + code in this case or rotate the loops to avoid this scenario. */ + if (bb1->loop_depth != bb2->loop_depth) return false; b1 = BRANCH_EDGE (bb1); @@ -1194,9 +1205,10 @@ outgoing_edges_match (mode, bb1, bb2) /* Do not use f2 probability as f2 may be forwarded. */ prob2 = REG_BR_PROB_BASE - b2->probability; - /* Fail if the difference in probabilities is - greater than 5%. */ - if (abs (b1->probability - prob2) > REG_BR_PROB_BASE / 20) + /* Fail if the difference in probabilities is greater than 50%. + This rules out two well-predicted branches with opposite + outcomes. */ + if (abs (b1->probability - prob2) > REG_BR_PROB_BASE / 5) { if (rtl_dump_file) fprintf (rtl_dump_file, diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 5bf33bc0795..a4f7006d392 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -56,6 +56,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "tm_p.h" #include "obstack.h" +#include "insn-config.h" /* Stubs in case we don't have a return insn. */ #ifndef HAVE_return @@ -546,6 +547,15 @@ split_block (bb, insn) propagate_block (new_bb, new_bb->global_live_at_start, NULL, NULL, 0); COPY_REG_SET (bb->global_live_at_end, new_bb->global_live_at_start); +#ifdef HAVE_conditional_execution + /* In the presence of conditional execution we are not able to update + liveness precisely. */ + if (reload_completed) + { + bb->flags |= BB_DIRTY; + new_bb->flags |= BB_DIRTY; + } +#endif } return new_edge; diff --git a/gcc/flow.c b/gcc/flow.c index 659815c5043..71ed939da63 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -764,7 +764,7 @@ update_life_info_in_dirty_blocks (extent, prop_flags) sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks); int block_num; int n = 0; - int ndead; + int retval = 0; sbitmap_zero (update_life_blocks); for (block_num = 0; block_num < n_basic_blocks; block_num++) @@ -775,10 +775,10 @@ update_life_info_in_dirty_blocks (extent, prop_flags) } if (n) - ndead = update_life_info (update_life_blocks, extent, prop_flags); + retval = update_life_info (update_life_blocks, extent, prop_flags); sbitmap_free (update_life_blocks); - return ndead; + return retval; } /* Free the variables allocated by find_basic_blocks.