This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: test patch for computed gotos
On Fri, Feb 14, 2003 at 05:49:03PM -0800, Richard Henderson wrote:
> I'll investigate further. Probably we want to drop the cutoff
> from 100 edges to like 10 edges, and make it a --param.
No, the problem is a bug in how we checked for cutoff. We'd not cut
off at all if a fallthru edge was found early in the list of edges.
The following makes the thing a param anyway, but even leaving the
default at 100 the compile time drops to 13 seconds.
r~
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.72
diff -c -p -d -r1.72 cfgcleanup.c
*** cfgcleanup.c 13 Feb 2003 18:31:40 -0000 1.72
--- cfgcleanup.c 15 Feb 2003 02:26:00 -0000
*************** Software Foundation, 59 Temple Place - S
*** 45,50 ****
--- 45,51 ----
#include "recog.h"
#include "toplev.h"
#include "cselib.h"
+ #include "params.h"
#include "tm_p.h"
#include "target.h"
*************** try_crossjump_bb (mode, bb)
*** 1464,1470 ****
{
edge e, e2, nexte2, nexte, fallthru;
bool changed;
! int n = 0;
/* Nothing to do if there is not at least two incoming edges. */
if (!bb->pred || !bb->pred->pred_next)
--- 1465,1471 ----
{
edge e, e2, nexte2, nexte, fallthru;
bool changed;
! int n = 0, max;
/* Nothing to do if there is not at least two incoming edges. */
if (!bb->pred || !bb->pred->pred_next)
*************** try_crossjump_bb (mode, bb)
*** 1473,1483 ****
/* It is always cheapest to redirect a block that ends in a branch to
a block that falls through into BB, as that adds no branches to the
program. We'll try that combination first. */
! for (fallthru = bb->pred; fallthru; fallthru = fallthru->pred_next, n++)
{
! if (fallthru->flags & EDGE_FALLTHRU)
! break;
! if (n > 100)
return false;
}
--- 1474,1486 ----
/* It is always cheapest to redirect a block that ends in a branch to
a block that falls through into BB, as that adds no branches to the
program. We'll try that combination first. */
! fallthru = NULL;
! max = PARAM_VALUE (PARAM_MAX_CROSSJUMP_EDGES);
! for (e = bb->pred; e ; e = e->pred_next, n++)
{
! if (e->flags & EDGE_FALLTHRU)
! fallthru = e;
! if (n > max)
return false;
}
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.994
diff -c -p -d -r1.994 Makefile.in
*** Makefile.in 13 Feb 2003 17:23:48 -0000 1.994
--- Makefile.in 15 Feb 2003 02:26:00 -0000
*************** cfganal.o : cfganal.c $(CONFIG_H) $(SYST
*** 1593,1601 ****
cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_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)
! cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
! $(TIMEVAR_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h $(RECOG_H) toplev.h \
! $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H)
cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \
$(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h flags.h
cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
--- 1593,1602 ----
cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_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)
! cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
! $(RTL_H) $(TIMEVAR_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h \
! $(RECOG_H) toplev.h $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H) \
! $(PARAMS_H)
cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \
$(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h flags.h
cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
Index: params.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/params.def,v
retrieving revision 1.20
diff -c -p -d -r1.20 params.def
*** params.def 8 Feb 2003 14:29:00 -0000 1.20
--- params.def 15 Feb 2003 02:26:00 -0000
*************** DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY,
*** 202,207 ****
--- 202,213 ----
this threshold (in percents). Used when profile feedback is not available",
50)
+ /* The maximum number of incoming edges to consider for crossjumping. */
+ DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES,
+ "max-crossjump-edges",
+ "The maximum number of incoming edges to consider for crossjumping",
+ 100)
+
#ifdef ENABLE_GC_ALWAYS_COLLECT
# define GGC_MIN_EXPAND_DEFAULT 0
# define GGC_MIN_HEAPSIZE_DEFAULT 0
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.240
diff -c -p -d -r1.240 invoke.texi
*** doc/invoke.texi 13 Feb 2003 17:23:56 -0000 1.240
--- doc/invoke.texi 15 Feb 2003 02:26:03 -0000
*************** In each case, the @var{value} is an inte
*** 4346,4351 ****
--- 4346,4358 ----
@var{name} are given in the following table:
@table @gcctabopt
+ @item max-crossjump-edges
+ The maximum number of incoming edges to consider for crossjumping.
+ The algorithm used by @option(-fcrossjumping) is @math{O(N^2)} in
+ the number of edges incoming to each block. Increasing values mean
+ more aggressive optimization, making the compile time increase with
+ probably small improvement in executable size.
+
@item max-delay-slot-insn-search
The maximum number of instructions to consider when looking for an
instruction to fill a delay slot. If more than this arbitrary number of