From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46834 invoked by alias); 1 Aug 2018 12:49:07 -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 44764 invoked by uid 89); 1 Aug 2018 12:49:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:874lghe, *loop, loop_vinfo_loop, Hybrid X-HELO: mail-lj1-f179.google.com Received: from mail-lj1-f179.google.com (HELO mail-lj1-f179.google.com) (209.85.208.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Aug 2018 12:49:04 +0000 Received: by mail-lj1-f179.google.com with SMTP id p6-v6so16741757ljc.5 for ; Wed, 01 Aug 2018 05:49:03 -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=/lJdKpz89h9CYzKRczJT24MJXZ+QnBKcg9k+9LePXH4=; b=QkvI7FF1jS7Co7M33wn25n9gOvXrIUyJqpxflAVfTNUhMGUquQwv24dDSbOd3DRB2O atmKOyCQf6cLaaRn5PcnvCYdeqP7lDnlh48S4HAeOg3stUiWIeKZDCGDPYYfPoKEY7Is 9FoiM7W4BbQEqdH3k2Vu46IzfVlOOkq4jZ7mWkMWhnPPRlNsAXySiZvtDi5WDLrfSA8R 2MKsCyZH9BwaY+kYMHvttZoeYVmBoNh8OLLNm0ucoLeR0qNMdIrvIXtxb+jSP18wwJTC qKBRcMc7Zx7bJjF94Ke0n3/KWTorgm/Kuyo1GPTQ82KgX1kxqrqKETgF/yYaqc0c1dC4 AUVw== MIME-Version: 1.0 References: <874lghez1a.fsf@arm.com> <87zhy9dkfd.fsf@arm.com> In-Reply-To: <87zhy9dkfd.fsf@arm.com> From: Richard Biener Date: Wed, 01 Aug 2018 12:49:00 -0000 Message-ID: Subject: Re: [01/11] Schedule SLP earlier To: GCC Patches , richard.sandiford@arm.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00066.txt.bz2 On Mon, Jul 30, 2018 at 1:37 PM Richard Sandiford wrote: > > vect_transform_loop used to call vect_schedule_slp lazily when it > came across the first SLP statement, but it seems easier to do it > before the main loop. Indeed. OK. Richard. > > 2018-07-30 Richard Sandiford > > gcc/ > * tree-vect-loop.c (vect_transform_loop_stmt): Remove slp_scheduled > argument. > (vect_transform_loop): Update calls accordingly. Schedule SLP > instances before the main loop, if any exist. > > Index: gcc/tree-vect-loop.c > =================================================================== > --- gcc/tree-vect-loop.c 2018-07-30 12:32:15.000000000 +0100 > +++ gcc/tree-vect-loop.c 2018-07-30 12:32:16.190624704 +0100 > @@ -8199,14 +8199,12 @@ scale_profile_for_vect_loop (struct loop > } > > /* Vectorize STMT_INFO if relevant, inserting any new instructions before GSI. > - When vectorizing STMT_INFO as a store, set *SEEN_STORE to its stmt_vec_info. > - *SLP_SCHEDULE is a running record of whether we have called > - vect_schedule_slp. */ > + When vectorizing STMT_INFO as a store, set *SEEN_STORE to its > + stmt_vec_info. */ > > static void > vect_transform_loop_stmt (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, > - gimple_stmt_iterator *gsi, > - stmt_vec_info *seen_store, bool *slp_scheduled) > + gimple_stmt_iterator *gsi, stmt_vec_info *seen_store) > { > struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); > poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo); > @@ -8237,24 +8235,10 @@ vect_transform_loop_stmt (loop_vec_info > dump_printf_loc (MSG_NOTE, vect_location, "multiple-types.\n"); > } > > - /* SLP. Schedule all the SLP instances when the first SLP stmt is > - reached. */ > - if (slp_vect_type slptype = STMT_SLP_TYPE (stmt_info)) > - { > - > - if (!*slp_scheduled) > - { > - *slp_scheduled = true; > - > - DUMP_VECT_SCOPE ("scheduling SLP instances"); > - > - vect_schedule_slp (loop_vinfo); > - } > - > - /* Hybrid SLP stmts must be vectorized in addition to SLP. */ > - if (slptype == pure_slp) > - return; > - } > + /* Pure SLP statements have already been vectorized. We still need > + to apply loop vectorization to hybrid SLP statements. */ > + if (PURE_SLP_STMT (stmt_info)) > + return; > > if (dump_enabled_p ()) > dump_printf_loc (MSG_NOTE, vect_location, "transform statement.\n"); > @@ -8284,7 +8268,6 @@ vect_transform_loop (loop_vec_info loop_ > tree niters_vector_mult_vf = NULL_TREE; > poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo); > unsigned int lowest_vf = constant_lower_bound (vf); > - bool slp_scheduled = false; > gimple *stmt; > bool check_profitability = false; > unsigned int th; > @@ -8390,6 +8373,14 @@ vect_transform_loop (loop_vec_info loop_ > /* This will deal with any possible peeling. */ > vect_prepare_for_masked_peels (loop_vinfo); > > + /* Schedule the SLP instances first, then handle loop vectorization > + below. */ > + if (!loop_vinfo->slp_instances.is_empty ()) > + { > + DUMP_VECT_SCOPE ("scheduling SLP instances"); > + vect_schedule_slp (loop_vinfo); > + } > + > /* FORNOW: the vectorizer supports only loops which body consist > of one basic block (header + empty latch). When the vectorizer will > support more involved loop forms, the order by which the BBs are > @@ -8468,16 +8459,15 @@ vect_transform_loop (loop_vec_info loop_ > stmt_vec_info pat_stmt_info > = loop_vinfo->lookup_stmt (gsi_stmt (subsi)); > vect_transform_loop_stmt (loop_vinfo, pat_stmt_info, > - &si, &seen_store, > - &slp_scheduled); > + &si, &seen_store); > } > stmt_vec_info pat_stmt_info > = STMT_VINFO_RELATED_STMT (stmt_info); > vect_transform_loop_stmt (loop_vinfo, pat_stmt_info, &si, > - &seen_store, &slp_scheduled); > + &seen_store); > } > vect_transform_loop_stmt (loop_vinfo, stmt_info, &si, > - &seen_store, &slp_scheduled); > + &seen_store); > } > gsi_next (&si); > if (seen_store)