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: [PATCH] Fix inconsistent pruning of aliases


On Tue, 20 Nov 2007, Richard Guenther wrote:

> On Tue, 20 Nov 2007, Daniel Berlin wrote:
> 
> > On 11/20/07, Richard Guenther <rguenther@suse.de> wrote:
> > > On Tue, 20 Nov 2007, Daniel Berlin wrote:
> > >
> > > > On 11/20/07, Richard Guenther <rguenther@suse.de> wrote:
> > 
> > > > At this point, you need to recompute aliasing (or move propagation to
> > > > a different point).
> > > > Trying to work around that is not going to work very well, it's not
> > > > what the machinery is meant for.
> > >
> > > Uhm, so we need to re-run may_alias after every copy-propagation?
> > >
> > >  p_2 = p_1
> > >  *p_2;
> > 
> > You at least need to copy the NMT from p_2 to p_1, yes.
> > 
> > You can't add new dereferences without doing *something* to inform the
> > alias machinery that new  dereferences have occurred.
> 
> Ok, so in this case phicprop is broken.  It propagates p_1 in
> 
>  # p_2 = PHI <p_1(2)>
>  *p_2
> 
> but does not merge alias info from p_2.

Likewise is CCP broken.  And I suspect _many_ other passes.

The following patch thus fixes the warning in 
get_addr_dereference_operands which does _not_ warn about this situation
(we do have SSA_NAME_PTR_INFO but no NMT).

I'm bootstrapping and testing this now, ok if that succeeds?  (The
dump_flag change makes the warning not use multiple lines)

I know that we (and you) previously just "ignored" those warnings.  Do
you say now they are potentially generating wrong code?  That is, does
the fallback SMT use not always "work"?  And if so, is that by design
or just by potential bugs in the fallback?

Thanks for clarification,
Richard.

2007-11-21  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-operands.c (get_addr_dereference_operands): Also
	warn for missing flow-sensitive alias info if only the NMT
	is missing.

Index: tree-ssa-operands.c
===================================================================
*** tree-ssa-operands.c	(revision 130328)
--- tree-ssa-operands.c	(working copy)
*************** get_addr_dereference_operands (tree stmt
*** 1643,1658 ****
  	  /* If we are emitting debugging dumps, display a warning if
  	     PTR is an SSA_NAME with no flow-sensitive alias
  	     information.  That means that we may need to compute
! 	     aliasing again.  */
  	  if (dump_file
  	      && TREE_CODE (ptr) == SSA_NAME
! 	      && pi == NULL)
  	    {
  	      fprintf (dump_file,
  		  "NOTE: no flow-sensitive alias info for ");
  	      print_generic_expr (dump_file, ptr, dump_flags);
  	      fprintf (dump_file, " in ");
! 	      print_generic_stmt (dump_file, stmt, dump_flags);
  	    }
  
  	  if (TREE_CODE (ptr) == SSA_NAME)
--- 1643,1660 ----
  	  /* If we are emitting debugging dumps, display a warning if
  	     PTR is an SSA_NAME with no flow-sensitive alias
  	     information.  That means that we may need to compute
! 	     aliasing again or that a propagation pass forgot to
! 	     update the alias information on the pointers.  */
  	  if (dump_file
  	      && TREE_CODE (ptr) == SSA_NAME
! 	      && (pi == NULL
! 		  || pi->name_mem_tag == NULL_TREE))
  	    {
  	      fprintf (dump_file,
  		  "NOTE: no flow-sensitive alias info for ");
  	      print_generic_expr (dump_file, ptr, dump_flags);
  	      fprintf (dump_file, " in ");
! 	      print_generic_stmt (dump_file, stmt, 0);
  	    }
  
  	  if (TREE_CODE (ptr) == SSA_NAME)


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