Hi, On Wed, Sep 07, 2011 at 11:35:53AM +0200, Richard Guenther wrote: > On Wed, Sep 7, 2011 at 9:47 AM, Terry Guo <terry....@arm.com> wrote: > > Hello, > > > > The SRA optimization requires the reference to struct/union member must be > > aligned to their natural boundary e.g. (int *) must be aligned to 4 byte > > boundary. This is done in function tree_non_mode_aligned_mem_p. For target > > like x86 that define "STRICT_ALIGNMENT" to 0, the function return false. > > Afterward, the SRA is conducted. For target like ARM or MIPS that define > > "STRICT_ALIGNMENT" to 1, the alignment status is checked by "align = > > get_object_alignment (exp)". The function get_object_alignment rely on SSA > > and tend to over-conservative. So for most cases, the SRA is stopped here. > > > > This patch intends to skip this case for target that set STRICT_ALIGNMENT to > > 1 otherwise the case will fail due to the SRA isn't performed actually. OK > > to commit to trunk? > > Hm, the testcase looks like it should actually pass even for strict-align > targets. Martin? >
Well, tree_non_mode_aligned_mem_p clearly does not really work very well and needs a more-or-less reimplementation, there has been a discussion about this already in August (and you even had a suggestion): http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00931.html This has been only slowly moving towards the top of my TODO list but I am aware of it and at the moment it is almost there, I should be looking at this issue pretty soon. The testcase certainly should pass also on strict alignment architectures and I'd prefer if it stayed enabled for them. Martin > Richard. > > > BR, > > Terry > > > > 2011-09-07 Terry Guo <terry....@arm.com> > > > > * gcc.dg/ipa/ipa-sra-2.c: Only run on > > targets that are non_strict_align. > > > > > > diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > index 3437a81..c6b4d63 100644 > > --- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > @@ -1,5 +1,6 @@ > > /* { dg-do compile } */ > > /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ > > +/* { dg-require-effective-target non_strict_align } */ > > > > struct bovid > > { > > > > > >