public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Ira Rosen <IRAR@il.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [patch] Fix PR tree-optimization/45902
Date: Mon, 11 Oct 2010 14:09:00 -0000	[thread overview]
Message-ID: <AANLkTikUyFcqya6LmkP_tkQPPcGaP6543kAX1N=hOio6@mail.gmail.com> (raw)
In-Reply-To: <OFA2C5EF1B.57DA87D7-ONC22577B9.00450843-C22577B9.0047BE43@il.ibm.com>

On Mon, Oct 11, 2010 at 3:03 PM, Ira Rosen <IRAR@il.ibm.com> wrote:
> Richard Guenther <richard.guenther@gmail.com> wrote on 11/10/2010 02:32:08
> PM:
>
>>
>> On Mon, Oct 11, 2010 at 2:19 PM, Ira Rosen <IRAR@il.ibm.com> wrote:
>> >
>> > Hi,
>> >
>> > This patch fixes a bug in creation of a vector of constants in SLP. The
>> > problem is in the type of created vector. It should be set to the
> vector
>> > type of the statement unless it's a pointer.
>> >
>> > Bootstrapped and tested on x86_64-suse-linux and checked that the
> failure
>> > is fixed on powerpc64-suse-linux.
>> >
>> > Committed to mainline, ok for 4.5?
>>
>> I don't think this makes sense.  If at all the selection of which type
>> to use should be based on the operation code and the operand
>> position, but not on CONSTANT_CLASS_P or pointer-type-ness.
>>
>> So - what operation code / operand position is currently mishandled?
>
> This function creates vectors of constants or loop invariants. If it's a
> variable (loop invariant), we know exactly the type, hence the check for
> CONSTANT_CLASS_P.
>
> I guess instead of checking the type we can check if it's POINTER_PLUS_EXPR
> to catch the cases where we need the operand's type instead of the stmt's
> vectype.
>
> Does this make sense?

That makes more sense, with ...

> Index: tree-vect-slp.c
> ===================================================================
> --- tree-vect-slp.c     (revision 165302)
> +++ tree-vect-slp.c     (working copy)
> @@ -1836,10 +1836,10 @@ vect_get_constant_vectors (slp_tree slp_
>   VEC (tree, heap) *voprnds = VEC_alloc (tree, heap, number_of_vectors);
>   bool constant_p, is_store;
>   tree neutral_op = NULL;
> +  enum tree_code code = gimple_assign_rhs_code (stmt);
>
>   if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)
>     {
> -      enum tree_code code = gimple_assign_rhs_code (stmt);
>       if (reduc_index == -1)
>         {
>           VEC_free (tree, heap, *vec_oprnds);
> @@ -1895,18 +1895,14 @@ vect_get_constant_vectors (slp_tree slp_
>     }
>
>   if (CONSTANT_CLASS_P (op))
> -    {
> -      constant_p = true;
> -      if (POINTER_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt))))
> -        vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
> -      else
> -        vector_type = STMT_VINFO_VECTYPE (stmt_vinfo);
> -    }
> +    constant_p = true;
>   else
> -    {
> -      constant_p = false;
> -      vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
> -    }
> +    constant_p = false;
> +
> +  if (code == POINTER_PLUS_EXPR)

checking

          && op_num == 2

(with a possible fixup for the reduction case where that doesn't seem to
be prevailing).

Thanks,
Richard.

> +    vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
> +  else
> +    vector_type = STMT_VINFO_VECTYPE (stmt_vinfo);
>
>   gcc_assert (vector_type);
>   nunits = TYPE_VECTOR_SUBPARTS (vector_type);
>
> Thanks,
> Ira
>
>
>

  reply	other threads:[~2010-10-11 14:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11 12:32 Ira Rosen
2010-10-11 12:56 ` Richard Guenther
2010-10-11 13:05   ` Ira Rosen
2010-10-11 14:09     ` Richard Guenther [this message]
2010-10-11 20:55       ` Ira Rosen
2010-10-12 10:13         ` Richard Guenther
2010-10-13  7:52           ` Ira Rosen
2010-10-16 18:48             ` H.J. Lu
2010-10-17  0:30               ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTikUyFcqya6LmkP_tkQPPcGaP6543kAX1N=hOio6@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=IRAR@il.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).