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: [tree-ssa PATCH] Pick memory consumption low hanging fruit


On Fri, 2003-11-21 at 02:21, law@redhat.com wrote:
> In message <200311200922.02374.s.bosscher@student.tudelft.nl>, Steven Bosscher 
> writes:
>  >                  -O2 -fno-tree-pre         idem. + -fno-tree-dominator-opts
>  >Total Allocated   862045732 (+12% ?!)       718380296
> Could very easily be the additional varrays.  I've got a patch which
> cuts them down significantly.  Unfortunately, that change has exposed
> a latent bug.  The bug is in a hunk of code I'm not particularly familiar
> with, so I've passed it to Diego.
>
This ought to fix the bug you found.  Got a test case we can add to the
testsuite?

We were not checking _REF nodes properly to see if their base address
was in global memory.  Will commit after bootstrap/tests are done.


Diego.


	* Makefile.in (tree-dfa.o): Add dependency on $(TREE_DUMP_H)
	* tree-dfa.c: Include tree-dump.h
	(compute_alias_sets): Call dump_function_to_file.
	(may_access_global_mem_p): Check if the base address of _REF nodes
	may point to global memory.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.903.2.137
diff -d -c -p -r1.903.2.137 Makefile.in
*** Makefile.in	21 Nov 2003 07:26:08 -0000	1.903.2.137
--- Makefile.in	21 Nov 2003 21:33:58 -0000
*************** tree-iterator.o : tree-iterator.c $(CONF
*** 1580,1586 ****
  tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
     $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \
     errors.h tree-inline.h $(HASHTAB_H) flags.h function.h $(TIMEVAR_H) \
!    tree-alias-common.h convert.h $(TM_H) coretypes.h langhooks.h
  tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
     $(RTL_H) $(TREE_H) $(TM_H) flags.h function.h except.h langhooks.h
  tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) \
--- 1580,1587 ----
  tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
     $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \
     errors.h tree-inline.h $(HASHTAB_H) flags.h function.h $(TIMEVAR_H) \
!    tree-alias-common.h convert.h $(TM_H) coretypes.h langhooks.h \
!    $(TREE_DUMP_H)
  tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
     $(RTL_H) $(TREE_H) $(TM_H) flags.h function.h except.h langhooks.h
  tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) \
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.184
diff -d -c -p -r1.1.4.184 tree-dfa.c
*** tree-dfa.c	21 Nov 2003 20:25:56 -0000	1.1.4.184
--- tree-dfa.c	21 Nov 2003 21:33:59 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 38,43 ****
--- 38,44 ----
  #include "flags.h"
  #include "function.h"
  #include "diagnostic.h"
+ #include "tree-dump.h"
  #include "tree-simple.h"
  #include "tree-flow.h"
  #include "tree-inline.h"
*************** compute_alias_sets (void)
*** 2120,2125 ****
--- 2121,2127 ----
      {
        dump_alias_info (dump_file);
        dump_referenced_vars (dump_file);
+       dump_function_to_file (current_function_decl, dump_file, dump_flags);
        dump_end (TDI_alias, dump_file);
      }
  }
*************** may_access_global_mem_p (tree expr)
*** 2342,2349 ****
    if (TREE_CONSTANT (expr) && !integer_zerop (expr))
      return true;
  
-   /* Recursively check the expression's operands.  */
    class = TREE_CODE_CLASS (TREE_CODE (expr));
    if (IS_EXPR_CODE_CLASS (class))
      {
        unsigned char i;
--- 2344,2361 ----
    if (TREE_CONSTANT (expr) && !integer_zerop (expr))
      return true;
  
    class = TREE_CODE_CLASS (TREE_CODE (expr));
+ 
+   /* If EXPR is a reference, see if its base address may access global
+      memory.  */
+   if (class == 'r')
+     {
+       while (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
+ 	expr = TREE_OPERAND (expr, 0);
+       return may_access_global_mem_p (expr);
+     }
+ 
+   /* Recursively check the expression's operands.  */
    if (IS_EXPR_CODE_CLASS (class))
      {
        unsigned char i;



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