From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5803 invoked by alias); 24 Jul 2018 10:08:42 -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 5702 invoked by uid 89); 24 Jul 2018 10:08:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jul 2018 10:08:40 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B4EBB7A9 for ; Tue, 24 Jul 2018 03:08:38 -0700 (PDT) Received: from localhost (unknown [10.32.99.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3D9483F237 for ; Tue, 24 Jul 2018 03:08:38 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [39/46] Replace STMT_VINFO_UNALIGNED_DR with the associated statement References: <87wotlrmen.fsf@arm.com> Date: Tue, 24 Jul 2018 10:08:00 -0000 In-Reply-To: <87wotlrmen.fsf@arm.com> (Richard Sandiford's message of "Tue, 24 Jul 2018 10:52:16 +0100") Message-ID: <878t61lzdn.fsf@arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-07/txt/msg01349.txt.bz2 After previous changes, it makes more sense to record which stmt's access is going to be aligned via peeling, rather than the associated scalar data reference. 2018-07-24 Richard Sandiford gcc/ * tree-vectorizer.h (_loop_vec_info::unaligned_dr): Replace with... (_loop_vec_info::unaligned_stmt): ...this new field. (LOOP_VINFO_UNALIGNED_DR): Delete. (LOOP_VINFO_UNALIGNED_STMT): New macro. * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Use LOOP_VINFO_UNALIGNED_STMT instead of LOOP_VINFO_UNALIGNED_DR. * tree-vect-loop-manip.c (get_misalign_in_elems): Likewise. (vect_gen_prolog_loop_niters): Likewise. * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Update after above change to _loop_vec_info. Index: gcc/tree-vectorizer.h =================================================================== --- gcc/tree-vectorizer.h 2018-07-24 10:24:08.924434128 +0100 +++ gcc/tree-vectorizer.h 2018-07-24 10:24:12.252404574 +0100 @@ -436,7 +436,7 @@ typedef struct _loop_vec_info : public v tree mask_compare_type; /* Unknown DRs according to which loop was peeled. */ - struct data_reference *unaligned_dr; + stmt_vec_info unaligned_stmt; /* peeling_for_alignment indicates whether peeling for alignment will take place, and what the peeling factor should be: @@ -445,7 +445,7 @@ typedef struct _loop_vec_info : public v If X>0: Peel first X iterations. If X=-1: Generate a runtime test to calculate the number of iterations to be peeled, using the dataref recorded in the field - unaligned_dr. */ + unaligned_stmt. */ int peeling_for_alignment; /* The mask used to check the alignment of pointers or arrays. */ @@ -576,7 +576,7 @@ #define LOOP_VINFO_DATAREFS(L) #define LOOP_VINFO_DDRS(L) (L)->shared->ddrs #define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters)) #define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment -#define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr +#define LOOP_VINFO_UNALIGNED_STMT(L) (L)->unaligned_stmt #define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts #define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs #define LOOP_VINFO_COMP_ALIAS_DDRS(L) (L)->comp_alias_ddrs Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c 2018-07-24 10:24:08.924434128 +0100 +++ gcc/tree-vect-data-refs.c 2018-07-24 10:24:12.248404609 +0100 @@ -2134,7 +2134,7 @@ vect_enhance_data_refs_alignment (loop_v peel_stmt_info, npeel); } - LOOP_VINFO_UNALIGNED_DR (loop_vinfo) = dr0; + LOOP_VINFO_UNALIGNED_STMT (loop_vinfo) = peel_stmt_info; if (npeel) LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) = npeel; else Index: gcc/tree-vect-loop-manip.c =================================================================== --- gcc/tree-vect-loop-manip.c 2018-07-24 10:24:05.740462405 +0100 +++ gcc/tree-vect-loop-manip.c 2018-07-24 10:24:12.248404609 +0100 @@ -1560,8 +1560,8 @@ vect_update_ivs_after_vectorizer (loop_v static tree get_misalign_in_elems (gimple **seq, loop_vec_info loop_vinfo) { - struct data_reference *dr = LOOP_VINFO_UNALIGNED_DR (loop_vinfo); - stmt_vec_info stmt_info = vect_dr_stmt (dr); + stmt_vec_info stmt_info = LOOP_VINFO_UNALIGNED_STMT (loop_vinfo); + struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); tree vectype = STMT_VINFO_VECTYPE (stmt_info); unsigned int target_align = STMT_VINFO_TARGET_ALIGNMENT (stmt_info); @@ -1594,8 +1594,8 @@ get_misalign_in_elems (gimple **seq, loo /* Function vect_gen_prolog_loop_niters Generate the number of iterations which should be peeled as prolog for the - loop represented by LOOP_VINFO. It is calculated as the misalignment of - DR - the data reference recorded in LOOP_VINFO_UNALIGNED_DR (LOOP_VINFO). + loop represented by LOOP_VINFO. It is calculated as the misalignment of DR + - the data reference recorded in LOOP_VINFO_UNALIGNED_STMT (LOOP_VINFO). As a result, after the execution of this loop, the data reference DR will refer to an aligned location. The following computation is generated: @@ -1626,12 +1626,12 @@ get_misalign_in_elems (gimple **seq, loo vect_gen_prolog_loop_niters (loop_vec_info loop_vinfo, basic_block bb, int *bound) { - struct data_reference *dr = LOOP_VINFO_UNALIGNED_DR (loop_vinfo); + stmt_vec_info stmt_info = LOOP_VINFO_UNALIGNED_STMT (loop_vinfo); + data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); tree var; tree niters_type = TREE_TYPE (LOOP_VINFO_NITERS (loop_vinfo)); gimple_seq stmts = NULL, new_stmts = NULL; tree iters, iters_name; - stmt_vec_info stmt_info = vect_dr_stmt (dr); tree vectype = STMT_VINFO_VECTYPE (stmt_info); unsigned int target_align = STMT_VINFO_TARGET_ALIGNMENT (stmt_info); Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c 2018-07-24 10:24:02.360492422 +0100 +++ gcc/tree-vect-loop.c 2018-07-24 10:24:12.252404574 +0100 @@ -817,7 +817,7 @@ _loop_vec_info::_loop_vec_info (struct l max_vectorization_factor (0), mask_skip_niters (NULL_TREE), mask_compare_type (NULL_TREE), - unaligned_dr (NULL), + unaligned_stmt (NULL), peeling_for_alignment (0), ptr_mask (0), ivexpr_map (NULL), @@ -2142,8 +2142,8 @@ vect_analyze_loop_2 (loop_vec_info loop_ /* Niters for peeled prolog loop. */ if (LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0) { - struct data_reference *dr = LOOP_VINFO_UNALIGNED_DR (loop_vinfo); - tree vectype = STMT_VINFO_VECTYPE (vect_dr_stmt (dr)); + stmt_vec_info stmt_info = LOOP_VINFO_UNALIGNED_STMT (loop_vinfo); + tree vectype = STMT_VINFO_VECTYPE (stmt_info); niters_th += TYPE_VECTOR_SUBPARTS (vectype) - 1; } else