public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Memory aliasing and stack slots
@ 2000-05-28  5:26 Geert Bosch
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Bosch @ 2000-05-28  5:26 UTC (permalink / raw)
  To: gcc, Richard Kenner

On Sun, 28 May 00 08:19:18 EDT, Richard Kenner wrote:

  Presumably, at least in some languages, X and Y will have different alias
  sets, so they won't conflict.  But that means that we might move load of X
  until after a store of Y, which is wrong.

If X and Y share the same stack slot, it seems to me that they should be
in the same alias set. Do you know if it is possible to determine
that X and Y share the same stack slot?

-Geert


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

* Re: Memory aliasing and stack slots
  2000-05-28  5:07 Richard Kenner
@ 2000-05-28 13:47 ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2000-05-28 13:47 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc

On Sun, May 28, 2000 at 08:07:28AM -0400, Richard Kenner wrote:
> Presumably, at least in some languages, X and Y will have different alias
> sets, so they won't conflict.  But that means that we might move load of X
> until after a store of Y, which is wrong.

See assign_stack_temp_for_type -- X and Y will not share a
stack slot if they do not have compatible alias sets.


r~

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

* Re: Memory aliasing and stack slots
@ 2000-05-28  5:47 Richard Kenner
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Kenner @ 2000-05-28  5:47 UTC (permalink / raw)
  To: bosch; +Cc: gcc

    If X and Y share the same stack slot, it seems to me that they should be
    in the same alias set. 

The alias set of an object is determined by its type and two objects of
different types can be assigned the same stack slot at different times.

    Do you know if it is possible to determine that X and Y share the
    same stack slot?

In general it's not.  Consider taking the address and passing it
through a const function that returns a pointer to the stucture.

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

* Memory aliasing and stack slots
@ 2000-05-28  5:07 Richard Kenner
  2000-05-28 13:47 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Kenner @ 2000-05-28  5:07 UTC (permalink / raw)
  To: gcc

I have a concern with the reuse of stack slots and memory aliasing.

Suppose we have a case where there are two lexical blocks within the same
basic block and we have something like:

	{
	  struct bar x;

	  x = ...
	  ... x ...
	}
	{
	  struct foo y;

	  y = ...
	  ... y ...
	}

Presumably, at least in some languages, X and Y will have different alias
sets, so they won't conflict.  But that means that we might move load of X
until after a store of Y, which is wrong.

We have exactly the same problem with having read-only stack slots, but it
will be much rarer.

Is there any good suggestion to fix this?  Perhaps we could put some note in
the insn stream when a stack slot dies, but that's a lot of notes.

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

end of thread, other threads:[~2000-05-28 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-28  5:26 Memory aliasing and stack slots Geert Bosch
  -- strict thread matches above, loose matches on Subject: below --
2000-05-28  5:47 Richard Kenner
2000-05-28  5:07 Richard Kenner
2000-05-28 13:47 ` Richard Henderson

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).