From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114249 invoked by alias); 31 Jul 2018 12:02:37 -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 114223 invoked by uid 89); 31 Jul 2018 12:02:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-lj1-f193.google.com Received: from mail-lj1-f193.google.com (HELO mail-lj1-f193.google.com) (209.85.208.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Jul 2018 12:02:34 +0000 Received: by mail-lj1-f193.google.com with SMTP id 203-v6so13439200ljj.13 for ; Tue, 31 Jul 2018 05:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=BlMJEpmjmCPit+lkvzosuSEdbGoywP+41mtwAqaskQI=; b=cutqJrGf+rvDmoyBuCl0mQJxfy7tsIOq2LNgzsJjxbV7A74razoqzr52Jy+saEUt4b 4WzlpKLKMCzf6orbsOMMNGnHkk65+3MEGZB4j+wgjc0pQ7AowC9LBGrBj3BqBcfqnHeF LC2z03qzONNJS9TcSZBCJDUk7Vw8NP1mphXvu/C32fr2ajMr7utZnh5mldKo07SYynBs NcoG9mZwibbgSCXtyCqDb7bJmsMTkhs/FX9eTY6udllefsmA0SM9uRqD29uB3f3IuEY6 3qs3RGMV1k1/Ooxo+88XUQtSeKgYp4SOrcWlj+9SKqnnZW0qFuhspSqy7cYj7B+0Xzp9 sL7g== MIME-Version: 1.0 References: <87wotlrmen.fsf@arm.com> <87zhyhkkrz.fsf@arm.com> In-Reply-To: <87zhyhkkrz.fsf@arm.com> From: Richard Biener Date: Tue, 31 Jul 2018 12:02:00 -0000 Message-ID: Subject: Re: [41/46] Add vec_info::remove_stmt To: GCC Patches , richard.sandiford@arm.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg01922.txt.bz2 On Tue, Jul 24, 2018 at 12:09 PM Richard Sandiford wrote: > > This patch adds a new helper function for permanently removing a > statement and its associated stmt_vec_info. OK. > > 2018-07-24 Richard Sandiford > > gcc/ > * tree-vectorizer.h (vec_info::remove_stmt): Declare. > * tree-vectorizer.c (vec_info::remove_stmt): New function. > * tree-vect-loop-manip.c (vect_set_loop_condition): Use it. > * tree-vect-loop.c (vect_transform_loop): Likewise. > * tree-vect-slp.c (vect_schedule_slp): Likewise. > * tree-vect-stmts.c (vect_remove_stores): Likewise. > > Index: gcc/tree-vectorizer.h > =================================================================== > --- gcc/tree-vectorizer.h 2018-07-24 10:24:16.552366384 +0100 > +++ gcc/tree-vectorizer.h 2018-07-24 10:24:19.544339803 +0100 > @@ -241,6 +241,7 @@ struct vec_info { > stmt_vec_info lookup_def (tree); > stmt_vec_info lookup_single_use (tree); > stmt_vec_info lookup_dr (data_reference *); > + void remove_stmt (stmt_vec_info); > > /* The type of vectorization. */ > vec_kind kind; > Index: gcc/tree-vectorizer.c > =================================================================== > --- gcc/tree-vectorizer.c 2018-07-24 10:24:16.552366384 +0100 > +++ gcc/tree-vectorizer.c 2018-07-24 10:24:19.544339803 +0100 > @@ -577,6 +577,20 @@ vec_info::lookup_dr (data_reference *dr) > return stmt_info; > } > > +/* Permanently remove the statement described by STMT_INFO from the > + function. */ > + > +void > +vec_info::remove_stmt (stmt_vec_info stmt_info) > +{ > + gcc_assert (!stmt_info->pattern_stmt_p); > + gimple_stmt_iterator si = gsi_for_stmt (stmt_info->stmt); > + unlink_stmt_vdef (stmt_info->stmt); > + gsi_remove (&si, true); > + release_defs (stmt_info->stmt); > + free_stmt_vec_info (stmt_info); > +} > + > /* A helper function to free scev and LOOP niter information, as well as > clear loop constraint LOOP_C_FINITE. */ > > Index: gcc/tree-vect-loop-manip.c > =================================================================== > --- gcc/tree-vect-loop-manip.c 2018-07-24 10:24:16.552366384 +0100 > +++ gcc/tree-vect-loop-manip.c 2018-07-24 10:24:19.540339838 +0100 > @@ -935,8 +935,12 @@ vect_set_loop_condition (struct loop *lo > loop_cond_gsi); > > /* Remove old loop exit test. */ > - gsi_remove (&loop_cond_gsi, true); > - free_stmt_vec_info (orig_cond); > + stmt_vec_info orig_cond_info; > + if (loop_vinfo > + && (orig_cond_info = loop_vinfo->lookup_stmt (orig_cond))) > + loop_vinfo->remove_stmt (orig_cond_info); > + else > + gsi_remove (&loop_cond_gsi, true); > > if (dump_enabled_p ()) > { > Index: gcc/tree-vect-loop.c > =================================================================== > --- gcc/tree-vect-loop.c 2018-07-24 10:24:12.252404574 +0100 > +++ gcc/tree-vect-loop.c 2018-07-24 10:24:19.540339838 +0100 > @@ -8487,28 +8487,18 @@ vect_transform_loop (loop_vec_info loop_ > vect_transform_loop_stmt (loop_vinfo, stmt_info, &si, > &seen_store, &slp_scheduled); > } > + gsi_next (&si); > if (seen_store) > { > if (STMT_VINFO_GROUPED_ACCESS (seen_store)) > - { > - /* Interleaving. If IS_STORE is TRUE, the > - vectorization of the interleaving chain was > - completed - free all the stores in the chain. */ > - gsi_next (&si); > - vect_remove_stores (DR_GROUP_FIRST_ELEMENT (seen_store)); > - } > + /* Interleaving. If IS_STORE is TRUE, the > + vectorization of the interleaving chain was > + completed - free all the stores in the chain. */ > + vect_remove_stores (DR_GROUP_FIRST_ELEMENT (seen_store)); > else > - { > - /* Free the attached stmt_vec_info and remove the > - stmt. */ > - free_stmt_vec_info (stmt); > - unlink_stmt_vdef (stmt); > - gsi_remove (&si, true); > - release_defs (stmt); > - } > + /* Free the attached stmt_vec_info and remove the stmt. */ > + loop_vinfo->remove_stmt (stmt_info); > } > - else > - gsi_next (&si); > } > } > > Index: gcc/tree-vect-slp.c > =================================================================== > --- gcc/tree-vect-slp.c 2018-07-24 10:24:02.360492422 +0100 > +++ gcc/tree-vect-slp.c 2018-07-24 10:24:19.540339838 +0100 > @@ -4087,7 +4087,6 @@ vect_schedule_slp (vec_info *vinfo) > slp_tree root = SLP_INSTANCE_TREE (instance); > stmt_vec_info store_info; > unsigned int j; > - gimple_stmt_iterator gsi; > > /* Remove scalar call stmts. Do not do this for basic-block > vectorization as not all uses may be vectorized. > @@ -4108,11 +4107,7 @@ vect_schedule_slp (vec_info *vinfo) > if (store_info->pattern_stmt_p) > store_info = STMT_VINFO_RELATED_STMT (store_info); > /* Free the attached stmt_vec_info and remove the stmt. */ > - gsi = gsi_for_stmt (store_info); > - unlink_stmt_vdef (store_info); > - gsi_remove (&gsi, true); > - release_defs (store_info); > - free_stmt_vec_info (store_info); > + vinfo->remove_stmt (store_info); > } > } > > Index: gcc/tree-vect-stmts.c > =================================================================== > --- gcc/tree-vect-stmts.c 2018-07-24 10:24:08.924434128 +0100 > +++ gcc/tree-vect-stmts.c 2018-07-24 10:24:19.544339803 +0100 > @@ -9842,8 +9842,8 @@ vect_transform_stmt (stmt_vec_info stmt_ > void > vect_remove_stores (stmt_vec_info first_stmt_info) > { > + vec_info *vinfo = first_stmt_info->vinfo; > stmt_vec_info next_stmt_info = first_stmt_info; > - gimple_stmt_iterator next_si; > > while (next_stmt_info) > { > @@ -9851,11 +9851,7 @@ vect_remove_stores (stmt_vec_info first_ > if (next_stmt_info->pattern_stmt_p) > next_stmt_info = STMT_VINFO_RELATED_STMT (next_stmt_info); > /* Free the attached stmt_vec_info and remove the stmt. */ > - next_si = gsi_for_stmt (next_stmt_info->stmt); > - unlink_stmt_vdef (next_stmt_info->stmt); > - gsi_remove (&next_si, true); > - release_defs (next_stmt_info->stmt); > - free_stmt_vec_info (next_stmt_info); > + vinfo->remove_stmt (next_stmt_info); > next_stmt_info = tmp; > } > }