Hi!

I've noticed that
#define vector(elcount, type)  \
__attribute__((vector_size((elcount)*sizeof(type)))) type
vector (4, int)
f1 (vector (4, int) a, int b)
{
  ((int *)&a)[0] = b;
  return a;
}

as well as

vector (4, int)
f2 (vector (4, int) a, int b)
{
  a[0] = b;
  return a;
}

don't result in vec_set_optab being used, instead the argument is
forced in memory.  The problem is that update_addresses_taken
wouldn't drop TREE_ADDRESSABLE from the vector when it is no
longer address taken.  While it can't be turned into DECL_GIMPLE_REG_P,
TREE_ADDRESSABLE can go, it will still not be considered a gimple register,
but at least the expander will be free to generate better code for it.

Bootstrapped/regtested on x86_64-linux and i686-linux, preapproved by
richi on IRC, committed to trunk.

2011-10-13  Jakub Jelinek  <ja...@redhat.com>
            Richard Guenther  <rguent...@suse.de>

        * tree-ssa.c (maybe_optimize_var): Drop TREE_ADDRESSABLE
        from vector or complex vars even if their DECL_UID is in not_reg_needs
        bitmap.

--- gcc/tree-ssa.c.jj   2011-10-13 11:19:30.000000000 +0200
+++ gcc/tree-ssa.c      2011-10-13 14:27:02.000000000 +0200
@@ -1976,6 +1976,8 @@ maybe_optimize_var (tree var, bitmap add
         a non-register.  Otherwise we are confused and forget to
         add virtual operands for it.  */
       && (!is_gimple_reg_type (TREE_TYPE (var))
+         || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE
+         || TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
          || !bitmap_bit_p (not_reg_needs, DECL_UID (var))))
     {
       TREE_ADDRESSABLE (var) = 0;

        Jakub

Reply via email to