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] More PTA fixes


This should shrink the amount of constraints and edges to consider.

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

Richard.


2010-04-20  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-structalias.c (do_sd_constraint): Add edges only
	from vars that can have pointers.
	(process_constraint): Dump useless constraints.

Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c	(revision 158518)
--- gcc/tree-ssa-structalias.c	(working copy)
*************** do_sd_constraint (constraint_graph_t gra
*** 1706,1712 ****
  	     the set.  Use ESCAPED as representative instead.  */
  	  else if (v->id == escaped_id)
  	    flag |= bitmap_set_bit (sol, escaped_id);
! 	  else if (add_graph_edge (graph, lhs, t))
  	    flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
  
  	  /* If the variable is not exactly at the requested offset
--- 1706,1713 ----
  	     the set.  Use ESCAPED as representative instead.  */
  	  else if (v->id == escaped_id)
  	    flag |= bitmap_set_bit (sol, escaped_id);
! 	  else if (v->may_have_pointers
! 		   && add_graph_edge (graph, lhs, t))
  	    flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
  
  	  /* If the variable is not exactly at the requested offset
*************** process_constraint (constraint_t t)
*** 2885,2890 ****
--- 2890,2905 ----
    /* ADDRESSOF on the lhs is invalid.  */
    gcc_assert (lhs.type != ADDRESSOF);
  
+   /* We shouldn't add constraints from things that cannot have pointers.
+      It's not completely trivial to avoid in the callers, so do it here.  */
+   if (rhs.type != ADDRESSOF
+       && !get_varinfo (rhs.var)->may_have_pointers)
+     return;
+ 
+   /* Likewise adding to the solution of a non-pointer var isn't useful.  */
+   if (!get_varinfo (lhs.var)->may_have_pointers)
+     return;
+ 
    /* This can happen in our IR with things like n->a = *p */
    if (rhs.type == DEREF && lhs.type == DEREF && rhs.var != anything_id)
      {


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