From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67319 invoked by alias); 24 Jul 2018 10:02:50 -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 67304 invoked by uid 89); 24 Jul 2018 10:02:49 -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:02:43 +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 130667A9 for ; Tue, 24 Jul 2018 03:02:42 -0700 (PDT) Received: from localhost (unknown [10.32.99.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 900253F237 for ; Tue, 24 Jul 2018 03:02:41 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [24/46] Make stmt_info_for_cost use a stmt_vec_info References: <87wotlrmen.fsf@arm.com> Date: Tue, 24 Jul 2018 10:02:00 -0000 In-Reply-To: <87wotlrmen.fsf@arm.com> (Richard Sandiford's message of "Tue, 24 Jul 2018 10:52:16 +0100") Message-ID: <871sbtossf.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/msg01333.txt.bz2 This patch makes stmt_info_for_cost carry a stmt_vec_info instead of a gimple stmt. The structure is internal to the vectoriser, so targets aren't affected. 2018-07-24 Richard Sandiford gcc/ * tree-vectorizer.h (stmt_info_for_cost::stmt): Replace with... (stmt_info_for_cost::stmt_info): ...this new field. (add_stmt_costs): Update accordingly. * tree-vect-loop.c (vect_compute_single_scalar_iteration_cost) (vect_get_known_peeling_cost): Likewise. (vect_estimate_min_profitable_iters): Likewise. * tree-vect-stmts.c (record_stmt_cost): Likewise. Index: gcc/tree-vectorizer.h =================================================================== --- gcc/tree-vectorizer.h 2018-07-24 10:23:18.856878757 +0100 +++ gcc/tree-vectorizer.h 2018-07-24 10:23:22.264848493 +0100 @@ -116,7 +116,7 @@ struct stmt_info_for_cost { int count; enum vect_cost_for_stmt kind; enum vect_cost_model_location where; - gimple *stmt; + stmt_vec_info stmt_info; int misalign; }; @@ -1282,10 +1282,7 @@ add_stmt_costs (void *data, stmt_vector_ stmt_info_for_cost *cost; unsigned i; FOR_EACH_VEC_ELT (*cost_vec, i, cost) - add_stmt_cost (data, cost->count, cost->kind, - (cost->stmt - ? vinfo_for_stmt (cost->stmt) - : NULL_STMT_VEC_INFO), + add_stmt_cost (data, cost->count, cost->kind, cost->stmt_info, cost->misalign, cost->where); } Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c 2018-07-24 10:23:12.060939107 +0100 +++ gcc/tree-vect-loop.c 2018-07-24 10:23:22.260848529 +0100 @@ -1136,13 +1136,9 @@ vect_compute_single_scalar_iteration_cos int j; FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), j, si) - { - struct _stmt_vec_info *stmt_info - = si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; - (void) add_stmt_cost (target_cost_data, si->count, - si->kind, stmt_info, si->misalign, - vect_body); - } + (void) add_stmt_cost (target_cost_data, si->count, + si->kind, si->stmt_info, si->misalign, + vect_body); unsigned dummy, body_cost = 0; finish_cost (target_cost_data, &dummy, &body_cost, &dummy); destroy_cost_data (target_cost_data); @@ -3344,24 +3340,16 @@ vect_get_known_peeling_cost (loop_vec_in int j; if (peel_iters_prologue) FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si) - { - stmt_vec_info stmt_info - = si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; - retval += record_stmt_cost (prologue_cost_vec, - si->count * peel_iters_prologue, - si->kind, stmt_info, si->misalign, - vect_prologue); - } + retval += record_stmt_cost (prologue_cost_vec, + si->count * peel_iters_prologue, + si->kind, si->stmt_info, si->misalign, + vect_prologue); if (*peel_iters_epilogue) FOR_EACH_VEC_ELT (*scalar_cost_vec, j, si) - { - stmt_vec_info stmt_info - = si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; - retval += record_stmt_cost (epilogue_cost_vec, - si->count * *peel_iters_epilogue, - si->kind, stmt_info, si->misalign, - vect_epilogue); - } + retval += record_stmt_cost (epilogue_cost_vec, + si->count * *peel_iters_epilogue, + si->kind, si->stmt_info, si->misalign, + vect_epilogue); return retval; } @@ -3497,13 +3485,9 @@ vect_estimate_min_profitable_iters (loop int j; FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), j, si) - { - struct _stmt_vec_info *stmt_info - = si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; - (void) add_stmt_cost (target_cost_data, si->count, - si->kind, stmt_info, si->misalign, - vect_epilogue); - } + (void) add_stmt_cost (target_cost_data, si->count, + si->kind, si->stmt_info, si->misalign, + vect_epilogue); } } else if (npeel < 0) @@ -3535,15 +3519,13 @@ vect_estimate_min_profitable_iters (loop int j; FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo), j, si) { - struct _stmt_vec_info *stmt_info - = si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; (void) add_stmt_cost (target_cost_data, si->count * peel_iters_prologue, - si->kind, stmt_info, si->misalign, + si->kind, si->stmt_info, si->misalign, vect_prologue); (void) add_stmt_cost (target_cost_data, si->count * peel_iters_epilogue, - si->kind, stmt_info, si->misalign, + si->kind, si->stmt_info, si->misalign, vect_epilogue); } } @@ -3566,20 +3548,12 @@ vect_estimate_min_profitable_iters (loop &epilogue_cost_vec); FOR_EACH_VEC_ELT (prologue_cost_vec, j, si) - { - struct _stmt_vec_info *stmt_info - = si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; - (void) add_stmt_cost (data, si->count, si->kind, stmt_info, - si->misalign, vect_prologue); - } + (void) add_stmt_cost (data, si->count, si->kind, si->stmt_info, + si->misalign, vect_prologue); FOR_EACH_VEC_ELT (epilogue_cost_vec, j, si) - { - struct _stmt_vec_info *stmt_info - = si->stmt ? vinfo_for_stmt (si->stmt) : NULL_STMT_VEC_INFO; - (void) add_stmt_cost (data, si->count, si->kind, stmt_info, - si->misalign, vect_epilogue); - } + (void) add_stmt_cost (data, si->count, si->kind, si->stmt_info, + si->misalign, vect_epilogue); prologue_cost_vec.release (); epilogue_cost_vec.release (); Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c 2018-07-24 10:23:15.756906285 +0100 +++ gcc/tree-vect-stmts.c 2018-07-24 10:23:22.260848529 +0100 @@ -98,9 +98,7 @@ record_stmt_cost (stmt_vector_for_cost * && STMT_VINFO_GATHER_SCATTER_P (stmt_info)) kind = vector_scatter_store; - stmt_info_for_cost si = { count, kind, where, - stmt_info ? STMT_VINFO_STMT (stmt_info) : NULL, - misalign }; + stmt_info_for_cost si = { count, kind, where, stmt_info, misalign }; body_cost_vec->safe_push (si); tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;