diff mbox

[PR,49094] Refrain from creating misaligned accesses in SRA

Message ID 20110726172249.GB20101@virgil.arch.suse.de
State New
Headers show

Commit Message

Martin Jambor July 26, 2011, 5:22 p.m. UTC
On Tue, Jul 26, 2011 at 09:39:02AM +0200, Richard Guenther wrote:
> On Mon, Jul 25, 2011 at 7:52 PM, Martin Jambor <mjambor@suse.cz> wrote:

...

> >
> > 2011-07-25  Martin Jambor  <mjambor@suse.cz>
> >
> >        * tree-sra.c (tree_non_mode_aligned_mem_p): Strip conversions and
> >        return false for invariants.
> >
> > Index: src/gcc/tree-sra.c
> > ===================================================================
> > --- src.orig/gcc/tree-sra.c
> > +++ src/gcc/tree-sra.c
> > @@ -1075,9 +1075,14 @@ tree_non_mode_aligned_mem_p (tree exp)
> >   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
> >   unsigned int align;
> >
> > +  while (CONVERT_EXPR_P (exp)
> 
> There can be no convert exprs here, and there can be at most one
> VIEW_CONVERT_EXPR.
> 
> > +        || TREE_CODE (exp) == VIEW_CONVERT_EXPR)
> > +    exp = TREE_OPERAND (exp, 0);
> > +
> >   if (TREE_CODE (exp) == SSA_NAME
> >       || TREE_CODE (exp) == MEM_REF
> >       || mode == BLKmode
> > +      || is_gimple_min_invariant (exp)
> >       || !STRICT_ALIGNMENT)
> >     return false;
> 
> Otherwise ok.
> 

OK, this is what I have just committed as revision 176797 after
re-testing.

Thanks,

Martin


2011-07-26  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (tree_non_mode_aligned_mem_p): Strip conversions and
	return false for invariants.

Comments

Martin Jambor July 27, 2011, 12:50 p.m. UTC | #1
Hi,

On Wed, Jul 27, 2011 at 02:34:59PM +0200, Ulrich Weigand wrote:
> Martin Jambor wrote:
> 
> > OK, this is what I have just committed as revision 176797 after
> > re-testing.
> 
> Thanks, this has fixed the forwprop-5.c regression on spu-elf on mainline.
> 
> I'm seeing the same failure on the 4.6 branch -- would this patch also be
> appropriate there?
> 

You're right, it should be applied to the 4.6 branch too.  Since you
have the setup to thest it, can you do it please?  Otherwise I'll do
it in a few days.

Thanks,

Martin
Richard Biener July 28, 2011, 7:59 a.m. UTC | #2
On Wed, Jul 27, 2011 at 9:23 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Martin Jambor wrote:
>> On Wed, Jul 27, 2011 at 02:34:59PM +0200, Ulrich Weigand wrote:
>> > Martin Jambor wrote:
>> >
>> > > OK, this is what I have just committed as revision 176797 after
>> > > re-testing.
>> >
>> > Thanks, this has fixed the forwprop-5.c regression on spu-elf on mainline.
>> >
>> > I'm seeing the same failure on the 4.6 branch -- would this patch also be
>> > appropriate there?
>> >
>>
>> You're right, it should be applied to the 4.6 branch too.  Since you
>> have the setup to thest it, can you do it please?  Otherwise I'll do
>> it in a few days.
>
> Full test on spu-elf has now completed.  In addition to the forwprop-5.c
> regression, the patch also fixes this regression (see PR 49545):
> FAIL: g++.dg/tree-ssa/fwprop-align.C scan-tree-dump-times forwprop2 "& 1" 0
>
> No new regressions.
>
> OK for the branch?

Ok.

Thanks,
Richard.

> Bye,
> Ulrich
>
> --
>  Dr. Ulrich Weigand
>  GNU Toolchain for Linux on System z and Cell BE
>  Ulrich.Weigand@de.ibm.com
>
diff mbox

Patch

Index: src/gcc/tree-sra.c
===================================================================
--- src.orig/gcc/tree-sra.c
+++ src/gcc/tree-sra.c
@@ -1075,9 +1075,13 @@  tree_non_mode_aligned_mem_p (tree exp)
   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
   unsigned int align;
 
+  if (TREE_CODE (exp) == VIEW_CONVERT_EXPR)
+    exp = TREE_OPERAND (exp, 0);
+
   if (TREE_CODE (exp) == SSA_NAME
       || TREE_CODE (exp) == MEM_REF
       || mode == BLKmode
+      || is_gimple_min_invariant (exp)
       || !STRICT_ALIGNMENT)
     return false;