public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* aliasing question
@ 2004-09-07 10:51 Jan Hubicka
  2004-09-07 14:22 ` Diego Novillo
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Hubicka @ 2004-09-07 10:51 UTC (permalink / raw)
  To: dnovillo, gcc

Hi,
while looking into releasing more SSA_NAMEs I run across following code
(in combining combine.i with -O2 on i686).
ssa dump says:

  #   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?

I will keep copy of the dumps around in the case you are interested to
look into it.  It is one of places (actually first nontrivial) where we
are leakign SSA_NAME unfreeed.

Honza

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: aliasing question
  2004-09-07 10:51 aliasing question Jan Hubicka
@ 2004-09-07 14:22 ` Diego Novillo
  2004-09-08 20:05   ` Jan Hubicka
  0 siblings, 1 reply; 3+ messages in thread
From: Diego Novillo @ 2004-09-07 14:22 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc

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.


Diego.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: aliasing question
  2004-09-07 14:22 ` Diego Novillo
@ 2004-09-08 20:05   ` Jan Hubicka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Hubicka @ 2004-09-08 20:05 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Jan Hubicka, gcc, gcc-patches

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-08 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-07 10:51 aliasing question Jan Hubicka
2004-09-07 14:22 ` Diego Novillo
2004-09-08 20:05   ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).