Re: [PATCH] Fix PR tree-optimization/51315

2012-01-05 Thread Richard Guenther
On Wed, Jan 4, 2012 at 5:24 PM, Eric Botcazou wrote: >> OK.  But passing small structures by value doesn't seem that rare -- >> especially in C++ -- and it doesn't feel right to disable SRA just because >> the backend likes to increase the alignment of stack vars. > > Agreed. > >> ...something lik

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-04 Thread Richard Sandiford
Eric Botcazou writes: > Regtested on SPARC/Solaris. Can you confirm that this fixes the > pessimization in all cases (and run the C testsuite for your favorite > ABI variant)? TIA. It does, and there were no regression on a C-only build & test for mips64-linux-gnu (-mabi=32/-mips16, -mabi=32, -

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-04 Thread Eric Botcazou
> OK. But passing small structures by value doesn't seem that rare -- > especially in C++ -- and it doesn't feel right to disable SRA just because > the backend likes to increase the alignment of stack vars. Agreed. > ...something like this sounds good, although you seem less than happy > with i

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-03 Thread Richard Guenther
On Tue, Jan 3, 2012 at 12:26 PM, Eric Botcazou wrote: >> Shouldn't we go back and unconditionally return false if lhs and (or?) rhs >> are BLKmode?  I suppose they are, in this case.  Or should we truncate >> the alignment from get_object_alignment to TYPE_ALIGN if it is bigger >> than that to avo

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-03 Thread Richard Sandiford
Eric Botcazou writes: >> Sorry for the late notice, but this regressed memcpy-1.c for n32 and n64 >> on mips64-linux-gnu. I realise memcpy-1.c isn't viewed as being a proper >> SRA test, but in this case I think it really is showing a genuine problem. >> We have: >> >> struct a {int a,b,c;} a

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-03 Thread Eric Botcazou
> Shouldn't we go back and unconditionally return false if lhs and (or?) rhs > are BLKmode? I suppose they are, in this case. Or should we truncate > the alignment from get_object_alignment to TYPE_ALIGN if it is bigger > than that to avoid this situation? Sorry, I didn't read your message befor

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-03 Thread Eric Botcazou
> Sorry for the late notice, but this regressed memcpy-1.c for n32 and n64 > on mips64-linux-gnu. I realise memcpy-1.c isn't viewed as being a proper > SRA test, but in this case I think it really is showing a genuine problem. > We have: > > struct a {int a,b,c;} a; > int test(struct a a)

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-03 Thread Richard Guenther
On Mon, Jan 2, 2012 at 8:00 PM, Richard Sandiford wrote: > Eric Botcazou writes: >>> You are basically (but non-optimally) locally re-implementing >>> what expr.c:get_object_or_type_alignment does, for the >>> bare MEM_REF case (you don't consider offsets that >>> do not change the alignment, nor

Re: [PATCH] Fix PR tree-optimization/51315

2012-01-02 Thread Richard Sandiford
Eric Botcazou writes: >> You are basically (but non-optimally) locally re-implementing >> what expr.c:get_object_or_type_alignment does, for the >> bare MEM_REF case (you don't consider offsets that >> do not change the alignment, nor alignment information >> present on the SSA name). > > Adjusted

Re: [PATCH] Fix PR tree-optimization/51315

2011-12-07 Thread Richard Guenther
On Wed, Dec 7, 2011 at 3:32 PM, Eric Botcazou wrote: >> You are basically (but non-optimally) locally re-implementing >> what expr.c:get_object_or_type_alignment does, for the >> bare MEM_REF case (you don't consider offsets that >> do not change the alignment, nor alignment information >> present

Re: [PATCH] Fix PR tree-optimization/51315

2011-12-07 Thread Eric Botcazou
> You are basically (but non-optimally) locally re-implementing > what expr.c:get_object_or_type_alignment does, for the > bare MEM_REF case (you don't consider offsets that > do not change the alignment, nor alignment information > present on the SSA name). Adjusted version attached, regression-t

Re: [PATCH] Fix PR tree-optimization/51315

2011-12-07 Thread Eric Botcazou
> You are basically (but non-optimally) locally re-implementing > what expr.c:get_object_or_type_alignment does, for the > bare MEM_REF case (you don't consider offsets that > do not change the alignment, nor alignment information > present on the SSA name). Gosh. And now I distinctly remember su

Re: [PATCH] Fix PR tree-optimization/51315

2011-12-07 Thread Richard Guenther
On Tue, Dec 6, 2011 at 11:24 PM, Eric Botcazou wrote: > Hi, > > this is a regression present on mainline and 4.6 branch at -O for the SPARC. > The compiler generates an unaligned access for the memcpy call in: > >  char *s > >  union >  { >    int32_t i; >    char a[sizeof (int32_t)]; >  } >  v; >

[PATCH] Fix PR tree-optimization/51315

2011-12-06 Thread Eric Botcazou
Hi, this is a regression present on mainline and 4.6 branch at -O for the SPARC. The compiler generates an unaligned access for the memcpy call in: char *s union { int32_t i; char a[sizeof (int32_t)]; } v; memcpy (v.a, s, sizeof (int32_t)); The memcpy call is folded to an