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] Improve peak memory usage with SSCVN


This improves (slightly) the peak memory-usage and compile-time of
the testcase in PR34683.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to mainline.

Richard.

2008-01-07  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/34683
	* tree-ssa-sccvn.c (vuses_to_vec): Pre-allocate the vector of
	VOPs of the needed size to save memory.  Use VEC_quick_push
	to save compile-time.
	(vdefs_to_vec): Likewise.

Index: tree-ssa-sccvn.c
===================================================================
*** tree-ssa-sccvn.c	(revision 131324)
--- tree-ssa-sccvn.c	(working copy)
*************** vuses_to_vec (tree stmt, VEC (tree, gc) 
*** 389,396 ****
    if (!stmt)
      return;
  
    FOR_EACH_SSA_TREE_OPERAND (vuse, stmt, iter, SSA_OP_VIRTUAL_USES)
!     VEC_safe_push (tree, gc, *result, vuse);
  
    if (VEC_length (tree, *result) > 1)
      sort_vuses (*result);
--- 389,398 ----
    if (!stmt)
      return;
  
+   *result = VEC_alloc (tree, gc, num_ssa_operands (stmt, SSA_OP_VIRTUAL_USES));
+ 
    FOR_EACH_SSA_TREE_OPERAND (vuse, stmt, iter, SSA_OP_VIRTUAL_USES)
!     VEC_quick_push (tree, *result, vuse);
  
    if (VEC_length (tree, *result) > 1)
      sort_vuses (*result);
*************** vdefs_to_vec (tree stmt, VEC (tree, gc) 
*** 421,428 ****
    if (!stmt)
      return;
  
    FOR_EACH_SSA_TREE_OPERAND (vdef, stmt, iter, SSA_OP_VIRTUAL_DEFS)
!     VEC_safe_push (tree, gc, *result, vdef);
  
    if (VEC_length (tree, *result) > 1)
      sort_vuses (*result);
--- 423,432 ----
    if (!stmt)
      return;
  
+   *result = VEC_alloc (tree, gc, num_ssa_operands (stmt, SSA_OP_VIRTUAL_DEFS));
+ 
    FOR_EACH_SSA_TREE_OPERAND (vdef, stmt, iter, SSA_OP_VIRTUAL_DEFS)
!     VEC_quick_push (tree, *result, vdef);
  
    if (VEC_length (tree, *result) > 1)
      sort_vuses (*result);


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