Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-23 Thread Jan Hubicka
> On June 23, 2014 6:15:10 PM CEST, Jan Hubicka wrote: > >> I don't like this very much. It's fragile and it will be very hard > >to > >> detect bugs caused by it. > >> > >> Please don't spread uses of the DECL_NONALIASED "hack". > >> > >> If we are only concerned about LTO I'd rather have a in

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-23 Thread Richard Biener
On June 23, 2014 6:15:10 PM CEST, Jan Hubicka wrote: >> I don't like this very much. It's fragile and it will be very hard >to >> detect bugs caused by it. >> >> Please don't spread uses of the DECL_NONALIASED "hack". >> >> If we are only concerned about LTO I'd rather have a in_lto_p check >>

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-23 Thread Jan Hubicka
> I don't like this very much. It's fragile and it will be very hard to > detect bugs caused by it. > > Please don't spread uses of the DECL_NONALIASED "hack". > > If we are only concerned about LTO I'd rather have a in_lto_p check > in may_be_aliased and trust TREE_ADDRESSABLE there. I do not

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-23 Thread Martin Jambor
Hi, On Mon, Jun 23, 2014 at 04:55:36AM +0200, Jan Hubicka wrote: > > > On Fri, 13 Jun 2014, Jan Hubicka wrote: > > > > > > > > > > > > > When you extract the address and use it. For example when you > > > > > do auto-parallelization and outline a part of your function it > > > > > passes arrays

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-23 Thread Richard Biener
On Mon, 23 Jun 2014, Jan Hubicka wrote: > > > On Fri, 13 Jun 2014, Jan Hubicka wrote: > > > > > > > > > > > > > When you extract the address and use it. For example when you > > > > > do auto-parallelization and outline a part of your function it > > > > > passes arrays as addresses. > > > > >

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-22 Thread Jan Hubicka
> > On Fri, 13 Jun 2014, Jan Hubicka wrote: > > > > > > > > > > When you extract the address and use it. For example when you > > > > do auto-parallelization and outline a part of your function it > > > > passes arrays as addresses. > > > > > > > > Or if you start to introduce address induction

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-13 Thread Jan Hubicka
> On Fri, 13 Jun 2014, Jan Hubicka wrote: > > > > > > > When you extract the address and use it. For example when you > > > do auto-parallelization and outline a part of your function it > > > passes arrays as addresses. > > > > > > Or if you start to introduce address induction variables like

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-13 Thread Richard Biener
On Fri, 13 Jun 2014, Jan Hubicka wrote: > > > > When you extract the address and use it. For example when you > > do auto-parallelization and outline a part of your function it > > passes arrays as addresses. > > > > Or if you start to introduce address induction variables like > > the vectoriz

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-12 Thread Jan Hubicka
> > When you extract the address and use it. For example when you > do auto-parallelization and outline a part of your function it > passes arrays as addresses. > > Or if you start to introduce address induction variables like > the vectorizer or IVOPTs does. I see, nothing really done by curre

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-12 Thread Richard Biener
On Thu, 12 Jun 2014, Jan Hubicka wrote: > > On Thu, 12 Jun 2014, Eric Botcazou wrote: > > > > > > If we want to give frontends a way to pass information that address of a > > > > given global object is not taken (apparently useful for Ada and its > > > > alias > > > > attribute), then I do not t

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-12 Thread Eric Botcazou
> Btw, may_be_aliased already does that. Indeed, and we could make use of that in Ada, at least in some cases. > Of course one issue is that it's impossible to write a verifier that > checks whether DECL_NONALIASED and TREE_ADDRESSABLE are "out-of-sync" > (because by design they can be). So it's

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-12 Thread Jan Hubicka
> On Thu, 12 Jun 2014, Eric Botcazou wrote: > > > > If we want to give frontends a way to pass information that address of a > > > given global object is not taken (apparently useful for Ada and its alias > > > attribute), then I do not think we are looking for middle-end only > > > solution. > >

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-12 Thread Richard Biener
On Thu, 12 Jun 2014, Eric Botcazou wrote: > > If we want to give frontends a way to pass information that address of a > > given global object is not taken (apparently useful for Ada and its alias > > attribute), then I do not think we are looking for middle-end only > > solution. > > I don't fee

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-12 Thread Eric Botcazou
> If we want to give frontends a way to pass information that address of a > given global object is not taken (apparently useful for Ada and its alias > attribute), then I do not think we are looking for middle-end only > solution. I don't feel very confortable with doing that in Ada, since everyb

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Jan Hubicka
> > Why not just make the change to may_be_aliased in LTO mode, with a comment > saying that TREE_PUBLIC and DECL_EXTERNAL aren't fully correct any longer? They are fully correct to the partition being compiled BTW. Honza

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Jan Hubicka
> > Sure. Still currently TREE_ADDRESSABLE on TREE_PUBLIC/DECL_EXTERNAL > > VAR_DECLs carries no useful information, so I consider the bit unused. > > I guess that's true for the middle-end in non-LTO mode at this point. > But then the new approach shouldn't be make correctness depend on its sett

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Eric Botcazou
> Sure. Still currently TREE_ADDRESSABLE on TREE_PUBLIC/DECL_EXTERNAL > VAR_DECLs carries no useful information, so I consider the bit unused. I guess that's true for the middle-end in non-LTO mode at this point. But then the new approach shouldn't be make correctness depend on its setting in th

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Richard Biener
On Wed, 11 Jun 2014, Eric Botcazou wrote: > > Because that's not the point and because it feels like a hack ;) > > Well, if we keep the current semantics of TREE_ADDRESSABLE and decide that > the > predicate for aliasing is may_be_aliased, the implementation for the latter > becomes a detail.

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Eric Botcazou
> Because that's not the point and because it feels like a hack ;) Well, if we keep the current semantics of TREE_ADDRESSABLE and decide that the predicate for aliasing is may_be_aliased, the implementation for the latter becomes a detail. And it would seem better/simpler to have the knowledge

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Richard Biener
On Wed, Jun 11, 2014 at 11:08 AM, Eric Botcazou wrote: >> Note that I'm happy to revert the change. > > Thanks. > >> I am hesitant to any approach that overloads TREE_ADDRESSABLE even more. >> It already is used for two (slightly) different things - first the >> "old" meaning that the address of t

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Richard Biener
On Wed, Jun 11, 2014 at 10:57 AM, Eric Botcazou wrote: >> Then why not just make the LTO front-end follow the existing semantics of >> TREE_ADDRESSABLE and clear it when it figures out that the address is not >> taken? That would seem the natural thing to do here. > > I meant "clear the TREE_PUBL

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Eric Botcazou
> Note that I'm happy to revert the change. Thanks. > I am hesitant to any approach that overloads TREE_ADDRESSABLE even more. > It already is used for two (slightly) different things - first the > "old" meaning that the address of the symbol is needed, second, that > the symbol is aliased by poi

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Eric Botcazou
> Then why not just make the LTO front-end follow the existing semantics of > TREE_ADDRESSABLE and clear it when it figures out that the address is not > taken? That would seem the natural thing to do here. I meant "clear the TREE_PUBLIC/DECL_EXTERNAL flags" of course... -- Eric Botcazou

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Eric Botcazou
> In non-LTO compilation I think it would allows us to optimize bettter in the > case address of the global symbol can not be taken by the other unit or it > can not escape back to current unit. For C/C++ this would be for runtime > generates symbols, like for gcov runtime (well if our initializat

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-11 Thread Richard Biener
On Wed, 11 Jun 2014, Jan Hubicka wrote: > > Note that I'm happy to revert the change. > > > > I am hesitant to any approach that overloads TREE_ADDRESSABLE even more. > > It already is used for two (slightly) different things - first the > > "old" meaning that the address of the symbol is needed,

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-10 Thread Jan Hubicka
> Note that I'm happy to revert the change. > > I am hesitant to any approach that overloads TREE_ADDRESSABLE even more. > It already is used for two (slightly) different things - first the > "old" meaning that the address of the symbol is needed, second, that > the symbol is aliased by pointers.

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-10 Thread Richard Biener
On Mon, 9 Jun 2014, Eric Botcazou wrote: > > I wonder if we want toupdate the frontends to set addressable flag with new > > sense or we want symtab to simple set addressable on all global symbols or > > invent a new flag. > > I would preffer the first case - it seems to make most sense to me. >

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-09 Thread Jan Hubicka
> > I wonder if we want toupdate the frontends to set addressable flag with new > > sense or we want symtab to simple set addressable on all global symbols or > > invent a new flag. > > I would preffer the first case - it seems to make most sense to me. > > I think you need to explain why this cha

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-09 Thread Eric Botcazou
> I wonder if we want toupdate the frontends to set addressable flag with new > sense or we want symtab to simple set addressable on all global symbols or > invent a new flag. > I would preffer the first case - it seems to make most sense to me. I think you need to explain why this change is desir

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-09 Thread Jan Hubicka
> > It is my fault here - I alwasy interpreted TREE_ADDRESSABLE this way and it > > seems to work for C/C++ that are the frontends I usually look into. > > But that's not true, see the obvious C testcase I attached in this thread! You are right - I never noticed the difference in cases I looked a

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-09 Thread Eric Botcazou
> It is my fault here - I alwasy interpreted TREE_ADDRESSABLE this way and it > seems to work for C/C++ that are the frontends I usually look into. But that's not true, see the obvious C testcase I attached in this thread! -- Eric Botcazou

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-08 Thread Jan Hubicka
> > ... In this particular translation unit you mean? > > Yes, in the translation unit being processed. > > > That would be worthless information for decls also reachable from elsewhere. > > It's the information: ADDR_EXPR of this DECL is taken somewhere in the IL, > it's no more or not less wo

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-07 Thread Eric Botcazou
> ... In this particular translation unit you mean? Yes, in the translation unit being processed. > That would be worthless information for decls also reachable from elsewhere. It's the information: ADDR_EXPR of this DECL is taken somewhere in the IL, it's no more or not less worthless than any

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-07 Thread Richard Biener
On June 7, 2014 2:06:47 PM CEST, Eric Botcazou wrote: >> An external variable is a VAR_DECL that cannot be in a register. It >> can be loaded into a register (or stored into), and for that its >> address is needed. So I would expect an external variable to be >marked >> addressable by default. > >

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-07 Thread Richard Biener
On June 7, 2014 1:54:06 PM CEST, Steven Bosscher wrote: >On Sat, Jun 7, 2014 at 12:59 PM, Eric Botcazou wrote: >>> >In Ada we don't mark (external) variables as addressable if we >don't >>> >see their address taken. >>> >>> You have to (now). The testing was of course to detect this... >> >> Well

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-07 Thread Eric Botcazou
> An external variable is a VAR_DECL that cannot be in a register. It > can be loaded into a register (or stored into), and for that its > address is needed. So I would expect an external variable to be marked > addressable by default. "address of this is needed" historically means ADDR_EXPR of th

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-07 Thread Steven Bosscher
On Sat, Jun 7, 2014 at 12:59 PM, Eric Botcazou wrote: >> >In Ada we don't mark (external) variables as addressable if we don't >> >see their address taken. >> >> You have to (now). The testing was of course to detect this... > > Well, you need to define what TREE_ADDRESSABLE means now, because acc

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-07 Thread Eric Botcazou
> Hmm, I don't see this. Usual scheduler-sensitive stuff I guess, here's the assembly I have: movqaliasing3_pkg__pointer(%rip), %rax testq %rax, %rax je .L6 cmpl$5, aliasing3_pkg__block(%rip) movl$5, (%rax) insns #4 and #5 have been wron

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-06 Thread Richard Biener
On June 6, 2014 7:15:55 PM CEST, Eric Botcazou wrote: >> Bootstrapped and tested on x86_64-unknown-linux-gnu for all >> languages including obj-c++, ada and go (yay), applied. > >Something went wrong because this nevertheless introduced a regression: > >FAIL: gnat.dg/aliasing3.adb execution test

Re: [PATCH] Trust TREE_ADDRESSABLE

2014-06-06 Thread Eric Botcazou
> Bootstrapped and tested on x86_64-unknown-linux-gnu for all > languages including obj-c++, ada and go (yay), applied. Something went wrong because this nevertheless introduced a regression: FAIL: gnat.dg/aliasing3.adb execution test In Ada we don't mark (external) variables as addressable if w