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]

Re: Memory consumption for bootstrap explodes


> Am Montag, 22. Juli 2002 19:39 schrieb David Edelsohn:
> [...]
> > Sun Jul 21 00:54:54 CEST 2002  Jan Hubicka  <jh@suse.cz>
> >
> > 	* gcse.c: Include cselib.h
> > 	(constptop_register): Break out from ...
> > 	(cprop_insn): ... here; kill basic_block argument.
> > 	(do_local_cprop, local_cprop_pass): New functions.
> > 	(one_cprop_pass): Call local_cprop_pass.
> [...]
> 
> This one is it. I went back to revision 1.209 of gcse.c (also reverting the 
> second patch in that file). Now localcharset.c compiles again.

Hmm, this patch seems to be causing all sorts of interesting problems
(probably as any new optimization in GCC).
The problem here is INSN having large UNSPEC and REG_EQUAL note
containing it.  It uses register 77 and clobbers it.  try_repalce_reg
manages to correctly replace 77 by copy propagated reg 92 in the insn
pattern insude UNSPEC, but fails to do so in REG_EQUAL note as
simplify_replace_rtx is used instead that gives up, so registers remains
sed".  In the new iterations it makes 0 changes but still believes it
has been sucesfull resulting in infinite recursion.

THe test in try_replace_rtx checking whether pattern contains registers
to be replaced is wrong as it matches on clobber that is not the use of
register.

The cleanest patch to solve this I am able to come with is to add new
function to count changes and verify that we actually changed something
before applying the group.  I believe this will solve John Wehles
problem as well.

Bootstrapped/regtested i386. OK?

Mon Jul 22 22:05:33 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* gcse.c (try_replace_reg): Use num_changes_pending.
	* recog.c (num_changes_pending): New function.
	(validate_replace_src): Use validate_repalce_src_group.
	(validate_replace_src_group): New.
	* recog.h (validate_repalce_src_group): New.
	(num_changes_pending): Likewise.
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcse.c,v
retrieving revision 1.211
diff -c -3 -p -r1.211 gcse.c
*** gcse.c	21 Jul 2002 19:38:08 -0000	1.211
--- gcse.c	22 Jul 2002 20:04:04 -0000
*************** try_replace_reg (from, to, insn)
*** 3975,3984 ****
    int success = 0;
    rtx set = single_set (insn);
  
!   if (reg_mentioned_p (from, PATTERN (insn)))
!     {
!       success = validate_replace_src (from, to, insn);
!     }
  
    if (!success && set && reg_mentioned_p (from, SET_SRC (set)))
      {
--- 3975,3983 ----
    int success = 0;
    rtx set = single_set (insn);
  
!   validate_replace_src_group (from, to, insn);
!   if (num_changes_pending () && apply_change_group ())
!     success = 1;
  
    if (!success && set && reg_mentioned_p (from, SET_SRC (set)))
      {
Index: recog.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.c,v
retrieving revision 1.160
diff -c -3 -p -r1.160 recog.c
*** recog.c	28 Jun 2002 15:43:53 -0000	1.160
--- recog.c	22 Jul 2002 20:04:07 -0000
*************** insn_invalid_p (insn)
*** 308,313 ****
--- 308,320 ----
    return 0;
  }
  
+ /* Return number of changes made and not validated yet.  */
+ int
+ num_changes_pending ()
+ {
+   return num_changes;
+ }
+ 
  /* Apply a group of changes previously issued with `validate_change'.
     Return 1 if all changes are valid, zero otherwise.  */
  
*************** validate_replace_src_1 (x, data)
*** 671,681 ****
  }
  
  /* Try replacing every occurrence of FROM in INSN with TO, avoiding
!    SET_DESTs.  After all changes have been made, validate by seeing if
!    INSN is still valid.  */
  
! int
! validate_replace_src (from, to, insn)
       rtx from, to, insn;
  {
    struct validate_replace_src_data d;
--- 678,687 ----
  }
  
  /* Try replacing every occurrence of FROM in INSN with TO, avoiding
!    SET_DESTs.  */
  
! void
! validate_replace_src_group (from, to, insn)
       rtx from, to, insn;
  {
    struct validate_replace_src_data d;
*************** validate_replace_src (from, to, insn)
*** 684,689 ****
--- 690,704 ----
    d.to = to;
    d.insn = insn;
    note_uses (&PATTERN (insn), validate_replace_src_1, &d);
+ }
+ 
+ /* Same as validate_repalace_src_group, but validate by seeing if
+    INSN is still valid.  */
+ int
+ validate_replace_src (from, to, insn)
+      rtx from, to, insn;
+ {
+   validate_replace_src_group (from, to, insn);
    return apply_change_group ();
  }
  
Index: recog.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.h,v
retrieving revision 1.42
diff -c -3 -p -r1.42 recog.h
*** recog.h	3 May 2002 22:23:42 -0000	1.42
--- recog.h	22 Jul 2002 20:04:07 -0000
*************** extern int validate_replace_rtx_subexp	P
*** 89,94 ****
--- 89,96 ----
  extern int validate_replace_rtx		PARAMS ((rtx, rtx, rtx));
  extern void validate_replace_rtx_group	PARAMS ((rtx, rtx, rtx));
  extern int validate_replace_src		PARAMS ((rtx, rtx, rtx));
+ extern void validate_replace_src_group	PARAMS ((rtx, rtx, rtx));
+ extern int num_changes_pending		PARAMS ((void));
  #ifdef HAVE_cc0
  extern int next_insn_tests_no_inequality PARAMS ((rtx));
  #endif


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