From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27721 invoked by alias); 20 Oct 2019 13:23:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 27713 invoked by uid 89); 20 Oct 2019 13:23:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=sk:treeve, sk:tree-ve, H*f:sk:mpto8yb, H*i:sk:mpto8yb X-HELO: foss.arm.com Received: from Unknown (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 20 Oct 2019 13:23:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B6D91493 for ; Sun, 20 Oct 2019 06:22:53 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E8BE3F718 for ; Sun, 20 Oct 2019 06:22:53 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [1/3] Avoid setting current_vector_size in get_vec_alignment_for_array_type References: Date: Sun, 20 Oct 2019 13:27:00 -0000 In-Reply-To: (Richard Sandiford's message of "Sun, 20 Oct 2019 14:21:32 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg01444.txt.bz2 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 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)