public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: [1/3] Avoid setting current_vector_size in get_vec_alignment_for_array_type
Date: Sun, 20 Oct 2019 13:27:00 -0000	[thread overview]
Message-ID: <mptk18zlff7.fsf@arm.com> (raw)
In-Reply-To: <mpto8yblfhf.fsf@arm.com> (Richard Sandiford's message of "Sun,	20 Oct 2019 14:21:32 +0100")

The increase_alignment pass was using get_vectype_for_scalar_type
to get the preferred vector type for each array element type.
This has the effect of carrying over the vector size chosen by
the first successful call to all subsequent calls, whereas it seems
more natural to treat each array type independently and pick the
"best" vector type for each element type.


2019-10-20  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.c (get_vec_alignment_for_array_type): Use
	get_vectype_for_scalar_type_and_size instead of
	get_vectype_for_scalar_type.

Index: gcc/tree-vectorizer.c
===================================================================
--- gcc/tree-vectorizer.c	2019-10-20 13:58:02.091634417 +0100
+++ gcc/tree-vectorizer.c	2019-10-20 14:13:50.784857051 +0100
@@ -1347,7 +1347,8 @@ get_vec_alignment_for_array_type (tree t
   gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
   poly_uint64 array_size, vector_size;
 
-  tree vectype = get_vectype_for_scalar_type (strip_array_types (type));
+  tree scalar_type = strip_array_types (type);
+  tree vectype = get_vectype_for_scalar_type_and_size (scalar_type, 0);
   if (!vectype
       || !poly_int_tree_p (TYPE_SIZE (type), &array_size)
       || !poly_int_tree_p (TYPE_SIZE (vectype), &vector_size)

  reply	other threads:[~2019-10-20 13:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-20 13:23 [0/3] Turn current_vector_size into a vec_info field Richard Sandiford
2019-10-20 13:27 ` Richard Sandiford [this message]
2019-10-30 14:22   ` [1/3] Avoid setting current_vector_size in get_vec_alignment_for_array_type Richard Biener
2019-10-20 13:30 ` [2/3] Pass vec_infos to more routines Richard Sandiford
2019-10-30 14:25   ` Richard Biener
2019-10-20 14:28 ` [3/3] Replace current_vector_size with vec_info::vector_size Richard Sandiford
2019-10-21  6:01 ` [0/3] Turn current_vector_size into a vec_info field Richard Biener

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=mptk18zlff7.fsf@arm.com \
    --to=richard.sandiford@arm.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).