This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Compilation time has more than doubled on some Polyhedron tests


On Sun, 15 Jan 2006, Daniel Berlin wrote:

> On Sun, 2006-01-15 at 18:35 -0500, Daniel Berlin wrote:
> > On Mon, 2006-01-16 at 00:24 +0100, Richard Guenther wrote:
> > > On Sun, 15 Jan 2006, Daniel Berlin wrote:
> > > > 
> > > > Again, this is why i was not convinced that array aliasing by
> > > > decomposing array's into SFT's like Richard has implemented is valuable
> > > > enough that it's worth the cost.
> > > 
> > > You are confusing the patches.  The patch that caused this regression
> > > does _not_ decompose arrays into SFTs.  Instead it just creates one SFT
> > > per array in a structure (and one for each other used element), like it
> > > was done before for structures that didn't contain an array.  I.e. it
> > > fixed PR22555.
> > > 
> > 
> > So it's still the same problem, just a different cause.
> > 
> > In this case, as i told you on IRC, the SFT's were originally meant to
> > let pointer analysis say things point to fields.  The fact that they
> Seems a line got lost.
> 
> "The fact that they happen to give nice dataflow information was a
> side-effect, not the primary goal".

I see that.  I'm testing the following fix to address the fortran
regressions.  The observation is that the fortran FE uses structures
to pass (lots of) arguments to I/O functions, and uses array descriptors
for passing arrays, which are handled similarly.  Now those structures
are only _written_ to in the caller (and have its address taken for the
call), so it's pointless to build dataflow information for those as this
will only result in really long clobber lists for the calls.

Does this look like a sane idea?

gcc.dg/tree-ssa/20031015-1.c detected as fallout sofar - it scans
for a (useless) V_MUST_DEF.  Otherwise tree-ssa.exp and execute.exp
succeeded on i686 and bootstrap is in stage > 1 (that it uses
prev-gcc/gcc is not very useful here...) on x86_64.

Richard.


2006-01-16  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-alias.c (struct used_part): Add write_only field.
	(get_or_create_used_part_for): Initialize it to true.
	(create_overlap_variables_for): Don't create structure variables
	for structures that only are written to.
	(find_used_portions): Handle MODIFY_EXPR to track whether a
	structure is only written to.

Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c	(revision 109743)
--- tree-ssa-alias.c	(working copy)
*************** typedef struct used_part
*** 2424,2429 ****
--- 2424,2431 ----
       variable.  Implicit uses occur when we can't tell what part we
       are referencing, and have to make conservative assumptions.  */
    bool implicit_uses;
+   /* True if the structure is only written to or taken its address.  */
+   bool write_only;
  } *used_part_t;
  
  /* An array of used_part structures, indexed by variable uid.  */
*************** get_or_create_used_part_for (size_t uid)
*** 2509,2514 ****
--- 2511,2517 ----
        up->maxused = 0;
        up->explicit_uses = false;
        up->implicit_uses = false;
+       up->write_only = true;
      }
  
    return up;
*************** create_overlap_variables_for (tree var)
*** 2552,2561 ****
    used_part_t up;
    size_t uid = DECL_UID (var);
  
!   if (!up_lookup (uid))
      return;
  
-   up = up_lookup (uid);
    push_fields_onto_fieldstack (TREE_TYPE (var), &fieldstack, 0, NULL);
    if (VEC_length (fieldoff_s, fieldstack) != 0)
      {
--- 2555,2565 ----
    used_part_t up;
    size_t uid = DECL_UID (var);
  
!   up = up_lookup (uid);
!   if (!up
!       || up->write_only)
      return;
  
    push_fields_onto_fieldstack (TREE_TYPE (var), &fieldstack, 0, NULL);
    if (VEC_length (fieldoff_s, fieldstack) != 0)
      {
*************** create_overlap_variables_for (tree var)
*** 2691,2700 ****
     entire structure.  */
  
  static tree
! find_used_portions (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
  {
    switch (TREE_CODE (*tp))
      {
      case REALPART_EXPR:
      case IMAGPART_EXPR:
      case COMPONENT_REF:
--- 2695,2709 ----
     entire structure.  */
  
  static tree
! find_used_portions (tree *tp, int *walk_subtrees, void *lhs_p)
  {
    switch (TREE_CODE (*tp))
      {
+     case MODIFY_EXPR:
+       /* Recurse manually here to track whether the use is in the
+ 	 LHS of an assignment.  */
+       find_used_portions (&TREE_OPERAND (*tp, 0), walk_subtrees, tp);
+       return find_used_portions (&TREE_OPERAND (*tp, 1), walk_subtrees, NULL);
      case REALPART_EXPR:
      case IMAGPART_EXPR:
      case COMPONENT_REF:
*************** find_used_portions (tree *tp, int *walk_
*** 2723,2728 ****
--- 2732,2739 ----
  	      up->explicit_uses = true;
  	    else
  	      up->implicit_uses = true;
+ 	    if (!lhs_p)
+ 	      up->write_only = false;
  	    up_insert (uid, up);
  
  	    *walk_subtrees = 0;


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