From: Jan Hubicka Date: Sun, 11 Jan 2004 15:56:26 +0000 (+0100) Subject: Partial fix for PR opt/10776 X-Git-Tag: releases/gcc-3.4.0~1117 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0bcf8261f4b9ef56378971c1745dd79024d44063;p=thirdparty%2Fgcc.git Partial fix for PR opt/10776 Partial fix for PR opt/10776 * Makefile.in (reload.o): Include param.h * params.def (PARAM_MAX_RELOAD_SEARCH_INSNS): New parameter. * reload.c: Include params.h. (find_equiv_reg): Work limiting check. * invoke.texi: Document. From-SVN: r75679 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6d23396e3e96..5dee099d179e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-01-11 Jan Hubicka + + Partial fix for PR opt/10776 + * Makefile.in (reload.o): Include param.h + * params.def (PARAM_MAX_RELOAD_SEARCH_INSNS): New parameter. + * reload.c: Include params.h. + (find_equiv_reg): Work limiting check. + * invoke.texi: Document. + 2004-01-11 Richard Sandiford * config/mips/mips.c (mips_symbolic_constant_p): Don't allow diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 101408e925dc..fde9b844cbb8 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1755,7 +1755,7 @@ ra-rewrite.o : ra-rewrite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) output.h except.h ra.h reload.h insn-config.h reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h output.h \ $(EXPR_H) $(OPTABS_H) reload.h $(RECOG_H) hard-reg-set.h insn-config.h \ - $(REGS_H) function.h real.h toplev.h $(TM_P_H) + $(REGS_H) function.h real.h toplev.h $(TM_P_H) $(PARAMS_H) reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) real.h flags.h \ $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.h \ $(BASIC_BLOCK_H) $(RECOG_H) output.h function.h toplev.h $(TM_P_H) \ diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b57ccd9cb586..2431cc7af312 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4853,6 +4853,14 @@ parameter very large effectively disables garbage collection. Setting this parameter and @option{ggc-min-expand} to zero causes a full collection to occur at every opportunity. +@table @gcctabopt +@item max-reload-search-insns +The maximum number of instruction reload should look backward for equivalent +register. Increasing values mean more aggressive optimization, making the +compile time increase with probably slightly better performance. The default +value is 100. + + @item reorder-blocks-duplicate @itemx reorder-blocks-duplicate-feedback diff --git a/gcc/params.def b/gcc/params.def index d665ad57ba45..a5b3099ca0e0 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -260,6 +260,11 @@ DEFPARAM(GGC_MIN_HEAPSIZE, #undef GGC_MIN_EXPAND_DEFAULT #undef GGC_MIN_HEAPSIZE_DEFAULT +DEFPARAM(PARAM_MAX_RELOAD_SEARCH_INSNS, + "max-reload-search-insns", + "The maximum number of instructions to search backward when looking for equivalent reload", + 100) + /* Local variables: mode:c diff --git a/gcc/reload.c b/gcc/reload.c index 13f6900ce3d5..361a5029cee4 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -104,6 +104,7 @@ a register with any other reload. */ #include "output.h" #include "function.h" #include "toplev.h" +#include "params.h" #ifndef REGNO_MODE_OK_FOR_BASE_P #define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) REGNO_OK_FOR_BASE_P (REGNO) @@ -6383,6 +6384,7 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other, int need_stable_sp = 0; int nregs; int valuenregs; + int num = 0; if (goal == 0) regno = goalreg; @@ -6423,6 +6425,7 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other, else return 0; + num = 0; /* Scan insns back from INSN, looking for one that copies a value into or out of GOAL. Stop and give up if we reach a label. */ @@ -6430,7 +6433,9 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class class, int other, while (1) { p = PREV_INSN (p); - if (p == 0 || GET_CODE (p) == CODE_LABEL) + num++; + if (p == 0 || GET_CODE (p) == CODE_LABEL + || num > PARAM_VALUE (PARAM_MAX_RELOAD_SEARCH_INSNS)) return 0; if (GET_CODE (p) == INSN