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]

[ssaupdate] One more use for local dominance


Hello,

one more use for local dominance info (for determining whether induction
variable can be expressed in a wider mode using bounds on number of
executions of a statement).

The parts of the patch in tree-pretty-print.c and tree-ssa-operands.c
should go to immuse branch as well, to avoid warnings on 64-bit
architectures.

Zdenek

Index: ChangeLog.ssaupdate
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.ssaupdate,v
retrieving revision 1.1.2.4
diff -c -3 -p -r1.1.2.4 ChangeLog.ssaupdate
*** ChangeLog.ssaupdate	20 Oct 2004 07:06:08 -0000	1.1.2.4
--- ChangeLog.ssaupdate	24 Oct 2004 17:27:00 -0000
***************
*** 1,3 ****
--- 1,14 ----
+ 2004-10-24  Zdenek Dvorak  <dvorakz@suse.cz>
+ 
+ 	* tree-cfg.c (stmt_dominated_by_p): Handle statements defining initial
+ 	value of a variable.
+ 	* tree-ssa-loop-niter.c (stmt_dominates_stmt_p): Removed.
+ 	(can_count_iv_in_wider_type_bound): Use stmt_dominated_by_p.
+ 
+ 	* tree-pretty-print.c (dump_generic_node): Cast pointer to size_t
+ 	first.
+ 	* tree-ssa-operands.c (test_imm_print, verify_abort): Ditto.
+ 
  2004-10-20  Zdenek Dvorak  <dvorakz@suse.cz>
  	    Andrew MacLeod  <amacleod@redhat.com>
  
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.73.4.3
diff -c -3 -p -r2.73.4.3 tree-cfg.c
*** tree-cfg.c	20 Oct 2004 07:06:08 -0000	2.73.4.3
--- tree-cfg.c	24 Oct 2004 17:27:00 -0000
*************** stmt_dominated_by_p (tree stmt1, tree st
*** 5597,5602 ****
--- 5597,5608 ----
    basic_block bb1 = bb_for_stmt (stmt1);
    basic_block bb2 = bb_for_stmt (stmt2);
  
+   if (!bb2)
+     return true;
+ 
+   if (!bb1)
+     return false;
+ 
    if (!dominated_by_p (CDI_DOMINATORS, bb1, bb2))
      return false;
  
Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v
retrieving revision 2.46.2.1
diff -c -3 -p -r2.46.2.1 tree-pretty-print.c
*** tree-pretty-print.c	17 Oct 2004 08:12:14 -0000	2.46.2.1
--- tree-pretty-print.c	24 Oct 2004 17:27:00 -0000
*************** dump_generic_node (pretty_printer *buffe
*** 243,249 ****
      dump_vops (buffer, node, spc, flags);
  
    if (is_stmt && (flags & TDF_STMT_ADDR))
!     pp_printf (buffer, "<&0x%x> ", (unsigned int)node);
  
    if (dumping_stmts
        && (flags & TDF_LINENO)
--- 243,249 ----
      dump_vops (buffer, node, spc, flags);
  
    if (is_stmt && (flags & TDF_STMT_ADDR))
!     pp_printf (buffer, "<&0x%x> ", (unsigned int)(size_t) node);
  
    if (dumping_stmts
        && (flags & TDF_LINENO)
Index: tree-ssa-loop-niter.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-niter.c,v
retrieving revision 2.10
diff -c -3 -p -r2.10 tree-ssa-loop-niter.c
*** tree-ssa-loop-niter.c	1 Oct 2004 09:06:06 -0000	2.10
--- tree-ssa-loop-niter.c	24 Oct 2004 17:27:00 -0000
*************** lower_bound_in_type (tree outer, tree in
*** 1129,1159 ****
  		       build_int_cst_wide (inner, lo, hi));
  }
  
- /* Returns true if statement S1 dominates statement S2.  */
- 
- static bool
- stmt_dominates_stmt_p (tree s1, tree s2)
- {
-   basic_block bb1 = bb_for_stmt (s1), bb2 = bb_for_stmt (s2);
- 
-   if (!bb1
-       || s1 == s2)
-     return true;
- 
-   if (bb1 == bb2)
-     {
-       block_stmt_iterator bsi;
- 
-       for (bsi = bsi_start (bb1); bsi_stmt (bsi) != s2; bsi_next (&bsi))
- 	if (bsi_stmt (bsi) == s1)
- 	  return true;
- 
-       return false;
-     }
- 
-   return dominated_by_p (CDI_DOMINATORS, bb2, bb1);
- }
- 
  /* Checks whether it is correct to count the induction variable BASE + STEP * I
     at AT_STMT in wider TYPE, using the fact that statement OF is executed at
     most BOUND times in the loop.  If it is possible, return the value of step
--- 1129,1134 ----
*************** can_count_iv_in_wider_type_bound (tree t
*** 1225,1231 ****
    else
      valid_niter = fold_convert (bound_type, valid_niter);
      
!   if (at_stmt && stmt_dominates_stmt_p (of, at_stmt))
      {
        /* After the statement OF we know that anything is executed at most
  	 BOUND times.  */
--- 1200,1206 ----
    else
      valid_niter = fold_convert (bound_type, valid_niter);
      
!   if (at_stmt && stmt_dominated_by_p (at_stmt, of))
      {
        /* After the statement OF we know that anything is executed at most
  	 BOUND times.  */
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.49.6.2
diff -c -3 -p -r2.49.6.2 tree-ssa-operands.c
*** tree-ssa-operands.c	20 Oct 2004 07:06:13 -0000	2.49.6.2
--- tree-ssa-operands.c	24 Oct 2004 17:27:00 -0000
*************** test_imm_print (FILE *file, use_operand_
*** 1931,1945 ****
      {
        if (stmt_modified_p (stmt) && TREE_CODE (stmt) != PHI_NODE)
          {
! 	  fprintf (file, " STMT MODIFIED. - <0x%x> ", (unsigned int)stmt);
  	  print_generic_stmt (file, stmt, TDF_SLIM);
  	}
        if (var->prev == NULL)
  	{
! 	  fprintf (file, " IMM ERROR : (use_p : tree: 0x%X:0x%x)", (unsigned int)var, (unsigned int)var->use);
  	  print_generic_expr (file, USE_FROM_PTR (var), TDF_SLIM);
  	  fprintf (file, " is not in a list\n");
! 	  fprintf (file, "<0x%x> ", (unsigned int)stmt);
  	  print_generic_stmt (file, stmt, TDF_VOPS);
  	}
      }
--- 1931,1949 ----
      {
        if (stmt_modified_p (stmt) && TREE_CODE (stmt) != PHI_NODE)
          {
! 	  fprintf (file, " STMT MODIFIED. - <0x%x> ",
! 		   (unsigned int)(size_t) stmt);
  	  print_generic_stmt (file, stmt, TDF_SLIM);
  	}
        if (var->prev == NULL)
  	{
! 	  fprintf (file, " IMM ERROR : (use_p : tree: 0x%X:0x%x)",
! 		   (unsigned int) (size_t) var,
! 		   (unsigned int) (size_t) var->use);
  	  print_generic_expr (file, USE_FROM_PTR (var), TDF_SLIM);
  	  fprintf (file, " is not in a list\n");
! 	  fprintf (file, "<0x%x> ",
! 		   (unsigned int) (size_t) stmt);
  	  print_generic_stmt (file, stmt, TDF_VOPS);
  	}
      }
*************** test_imm_links(FILE *file ATTRIBUTE_UNUS
*** 1994,2011 ****
  
  #ifdef ENABLE_CHECKING
  static void 
! verify_abort(ssa_imm_use_t *var)
  {
!   tree stmt;
!   if ((stmt = var->stmt))
      {
        if (stmt_modified_p(stmt))
  	{
! 	  fprintf (stderr, " STMT MODIFIED. - <0x%x> ", (unsigned int)stmt);
  	  print_generic_stmt (stderr, stmt, TDF_SLIM);
  	}
      }
!   fprintf (stderr, " IMM ERROR : (use_p : tree: 0x%X:0x%x)", (unsigned int)var, (unsigned int)var->use);
    print_generic_expr (stderr, USE_FROM_PTR (var), TDF_SLIM);
    abort ();
  }
--- 1998,2020 ----
  
  #ifdef ENABLE_CHECKING
  static void 
! verify_abort (ssa_imm_use_t *var)
  {
!   tree stmt = var->stmt;
! 
!   if (stmt)
      {
        if (stmt_modified_p(stmt))
  	{
! 	  fprintf (stderr, " STMT MODIFIED. - <0x%x> ",
! 		   (unsigned int) (size_t) stmt);
  	  print_generic_stmt (stderr, stmt, TDF_SLIM);
  	}
      }
! 
!   fprintf (stderr, " IMM ERROR : (use_p : tree: 0x%X:0x%x)",
! 	   (unsigned int) (size_t) var,
! 	   (unsigned int) (size_t) var->use);
    print_generic_expr (stderr, USE_FROM_PTR (var), TDF_SLIM);
    abort ();
  }


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