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]

[tree-ssa] Minor dominator cleanup


It has always bugged me that changing the virtual operands of a statement
didn't cause the statement to be considered modified.

With some of the recent work on the dominator optimizer, it is now possible
to set the modified bit when we change the virtual operands on a statement.

	* tree-ssa-dom.c (optimize_stmt): Note that the statement is
	modified, even if we just change the virtual operands.  If
	the statement was modified by const/copy propagation, then
	set may_have_exposed_new_symbols.
	
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.37
diff -c -3 -p -r1.1.2.37 tree-ssa-dom.c
*** tree-ssa-dom.c	16 Sep 2003 03:08:08 -0000	1.1.2.37
--- tree-ssa-dom.c	17 Sep 2003 18:40:51 -0000
*************** optimize_stmt (block_stmt_iterator si, v
*** 840,849 ****
  	    else
  	      *op_p = val;
  
! 	    /* If we only update virtual operands, then we should not
! 	       consider this statement as modified.  */
! 	    if (*table != vuses && *table != vdefs)
! 	      ann->modified = 1;
  	}
      }
  
--- 840,849 ----
  	    else
  	      *op_p = val;
  
! 	    /* And note that we modified this statement.  This is now
! 	       safe, even if we changed virtual operands since we will
! 	       rescan the statement and rewrite its operands again.  */
! 	    ann->modified = 1;
  	}
      }
  
*************** optimize_stmt (block_stmt_iterator si, v
*** 851,863 ****
       fold its RHS before checking for redundant computations.  */
    if (ann->modified)
      {
        if (fold_stmt (bsi_stmt_ptr (si)))
! 	{
! 	  stmt = bsi_stmt (si);
! 	  /* Folding may have removed the need for some vops/vdefs,
! 	     particularly if we folded away a call to a builtin.  */
! 	  may_have_exposed_new_symbols = true;
! 	}
      }
  
    /* Check for redundant computations.  Do this optimization only
--- 851,867 ----
       fold its RHS before checking for redundant computations.  */
    if (ann->modified)
      {
+       /* Try to fold the statement making sure that STMT is kept
+ 	 up to date.  */
        if (fold_stmt (bsi_stmt_ptr (si)))
! 	stmt = bsi_stmt (si);
! 
!       /* Constant/copy propagation above may change the set of 
! 	 virtual operands associated with this statement.  Folding
! 	 may remove the need for some virtual operands.
! 
! 	 Indicate we will need to rescan and rewrite the statement.  */
!       may_have_exposed_new_symbols = true;
      }
  
    /* Check for redundant computations.  Do this optimization only




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