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: aliasing question


> On Tue, 2004-09-07 at 06:51, Jan Hubicka wrote:
> 
> >   #   V_MUST_DEF <value_49>;
> >   value = T.4862_48;
> > 
> > and alias1 dump:
> > 
> >   #   value_229 = V_MAY_DEF <value_19>;
> >   value = T.4862_48;
> > 
> > Why the MUST_DEF is getting converted to MAY_DEF in such a obvious case
> > for MUST_DEF?
> > 
> Before aliasing, 'value' did not belong to any alias set, but after
> aliasing it is.  If we didn't do that, suppose that:
> 
> *p, alias tag TMT.1, alias set of TMT.1 = { value }
> 
>      1. p = (cond) ? &value : foo ();
>      2. *p = 3;
>      3. value = T.4862;
>      4. return *p;
> 
> If you put a V_MUST_DEF in statement #3, you will consider '*p = 3'
> dead.  Perhaps, we could put a V_MUST_DEF if there were more than one
> element in TMT.1's alias set.  Not sure how much would that buy, but it
> may be an interesting experiment.

Hi,
as discussed on the IRC, this check looks unnecesary after all (ie at
least my understanding is that optimizer should not conclude the *p dead
just from the fact that all object in the alias set has been mustdeffed
because the pointer still can point elsewhere).  I've
bootstrapped&regtested the attached patch and commited it after Diego's
approval.

Honza

2004-09-08  Jan Hubicka  <jh@suse.cz>
	* tree-ssa-operands.c (add_stmt_operand): Use V_MUST_DEF even for
	variables being alias set.
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.36
diff -c -3 -p -r2.36 tree-ssa-operands.c
*** tree-ssa-operands.c	5 Sep 2004 15:24:15 -0000	2.36
--- tree-ssa-operands.c	7 Sep 2004 15:05:47 -0000
*************** add_stmt_operand (tree *var_p, tree stmt
*** 1487,1502 ****
  	  /* The variable is not aliased or it is an alias tag.  */
  	  if (flags & opf_is_def)
  	    {
! 	      if (v_ann->is_alias_tag)
! 	        {
! 		  /* Alias tagged vars get V_MAY_DEF to avoid breaking
! 		     def-def chains with the other variables in their
! 		     alias sets.  */
! 		  if (s_ann)
! 		    s_ann->makes_aliased_stores = 1;
! 		  append_v_may_def (var);
! 		}
! 	      else if (flags & opf_kill_def)
  		{
  #if defined ENABLE_CHECKING
  		  /* Only regular variables may get a V_MUST_DEF
--- 1487,1493 ----
  	  /* The variable is not aliased or it is an alias tag.  */
  	  if (flags & opf_is_def)
  	    {
! 	      if (flags & opf_kill_def)
  		{
  #if defined ENABLE_CHECKING
  		  /* Only regular variables may get a V_MUST_DEF


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