This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] for optimization/12440


Hello,

loop optimizer keeps allocating trash due to expression simplification,
which leads to huge amount of memory consumed in case there is a lot of
loops in the function.  This patch fixes it by running garbage collector
after each loop is optimized.

Bootstrapped & regtested on i686.

Zdenek

	PR optimization/12440
	* loop.c: Include ggc.h.
	(loop_optimize): Run garbage collector between optimization of loops.
	* Makefile.in (loop.o): Add GGC_H dependency.

Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.485
diff -c -3 -p -r1.485 loop.c
*** loop.c	6 Jan 2004 16:51:17 -0000	1.485
--- loop.c	10 Jan 2004 23:04:56 -0000
*************** Software Foundation, 59 Temple Place - S
*** 65,70 ****
--- 65,71 ----
  #include "insn-flags.h"
  #include "optabs.h"
  #include "cfgloop.h"
+ #include "ggc.h"
  
  /* Not really meaningful values, but at least something.  */
  #ifndef SIMULTANEOUS_PREFETCHES
*************** loop_optimize (rtx f, FILE *dumpfile, in
*** 534,540 ****
        struct loop *loop = &loops->array[i];
  
        if (! loop->invalid && loop->end)
! 	scan_loop (loop, flags);
      }
  
    end_alias_analysis ();
--- 535,544 ----
        struct loop *loop = &loops->array[i];
  
        if (! loop->invalid && loop->end)
! 	{
! 	  scan_loop (loop, flags);
! 	  ggc_collect ();
! 	}
      }
  
    end_alias_analysis ();
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1217
diff -c -3 -p -r1.1217 Makefile.in
*** Makefile.in	9 Jan 2004 01:18:35 -0000	1.1217
--- Makefile.in	10 Jan 2004 23:05:01 -0000
*************** value-prof.o : value-prof.c $(CONFIG_H) 
*** 1676,1682 ****
  loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(LOOP_H) \
     insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
     real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h cfgloop.h \
!    toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H)
  doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
     $(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h \
     cfgloop.h
--- 1676,1682 ----
  loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(LOOP_H) \
     insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
     real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h cfgloop.h \
!    toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H) $(GGC_H)
  doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
     $(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h \
     cfgloop.h


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]