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: tree-ssa-sink breaks stack layout


On Mon, Apr 6, 2009 at 1:46 AM, Mark Mitchell <mark@codesourcery.com> wrote:
> Richard Guenther wrote:
>
>>>> I suggest to merge all overlapping scopes, not just detect if variable
>>>> accesses have been migrated outside their scope (that's not easy - if
>>>> you just move a stmt its lexical block does not change, instead if
>>>> you scan stmts looking for out-of-order (or unknown) blocks for stmts
>>>> then you know sth bad may have happened)
>>> That sounds plausible. ?This is just checking GIMPLE_STMT_BLOCK, right?
>>
>> Yes.
>
> How would you actually avoid the conflicting allocation? ?I guess just
> run through the block tree in a new add_lexical_block_conflicts function
> to record conflicts? ?Or bail out completely if you spot such oddities
> in the block tree?

For the purpose of stack allocation I would track semantically
equivalent block trees, thus add one indirection here.  I'm not
sure just recording a block conflict map is enough if you consider

  {  block 1
     X a;
  }
  {  block 2
     X b;
  }
  {  block 3
     X c;
  }

and if an access to c in moved to block 1 then you would say
block 1 and 3 conflict - but in fact there is also a conflict with
block 2.  I would instead force a "merge" of all blocks into
the nearest common anchestor of block 1 and block 3 which
also would include block 2.  Maybe this is overly conservative,
but it should catch really all cases.

We might need to fix places where we insert new statements
but do not set a block.  Otherwise we have to assume the
worst (at least for indirect loads/stores where we do not have
an easy way to get at the "original" block of a decl).

Richard.


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