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]

Tweek basic_block_info allocation


Hi,
While looking for memory corruption I fixed yesterday I noticed that we
allocate basic_block_info differently on trees and rtl.  The rtl one
results in quite many reallocations so this patch brings it into sync.
Bootstrapped/regtested i686-pc-gnu-linux, OK for mainline?
Installed to tree-profiling branch

2004-03-15  Jan Hubicka  <jh@suse.cz>

	* cfgrtl.c (rtl_create_basic_block): Pre-allocate basic_block_info
	array.

Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.57.2.28.2.4
diff -c -3 -p -r1.57.2.28.2.4 cfgrtl.c
*** cfgrtl.c	7 Mar 2004 22:23:54 -0000	1.57.2.28.2.4
--- cfgrtl.c	15 Mar 2004 16:46:20 -0000
*************** rtl_create_basic_block (void *headp, voi
*** 337,344 ****
    rtx head = headp, end = endp;
    basic_block bb;
  
!   /* Place the new block just after the end.  */
!   VARRAY_GROW (basic_block_info, last_basic_block + 1);
  
    n_basic_blocks++;
  
--- 337,348 ----
    rtx head = headp, end = endp;
    basic_block bb;
  
!   /* Grow the basic block array if needed.  */
!   if ((size_t) last_basic_block >= VARRAY_SIZE (basic_block_info))
!     {
!       size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
!       VARRAY_GROW (basic_block_info, new_size);
!     }
  
    n_basic_blocks++;
  


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