From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86497 invoked by alias); 7 Jan 2019 14:38:59 -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 85771 invoked by uid 89); 7 Jan 2019 14:38:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Mon, 07 Jan 2019 14:38:54 +0000 Received: by mail-lj1-f179.google.com with SMTP id t18-v6so523344ljd.4 for ; Mon, 07 Jan 2019 06:38:54 -0800 (PST) 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=RNdc3fErcT+Mb5/6LNWldV+uUEUcnfpQTyI0yPiu7cE=; b=IGYx02oKofF/q6yWpbpndpJL7qSz2j0m20i/T3jzFy9uMoXwG287QP43hblicuYTQ3 sPV7BdrUnLCFPVzRRcBh9ID/HL4EOvwVq3XC00dGes0kXuf7IuU8qy6SxKBHV7HoRiMB 11X301PPAqX1bl83iMNBLoe9OIelyjCt6M/cAJSERPnCEWTfQscpj2ajPvAvKMHuJ1gT faUtAjYN3ZHTz4PBMW6tExgvhrTg40fgAqNe8H0l3IE26zLsoIFYJKC9sYVx3hkU2pXx 9ItkOs8cAGJbjsDhBZLD4jCBuxjZ+u2NNGCDBVDP9iOza6LAsuyERLncLz9IPfqIaVAI uIGw== MIME-Version: 1.0 References: <877efgmwcd.fsf@arm.com> In-Reply-To: <877efgmwcd.fsf@arm.com> From: Richard Biener Date: Mon, 07 Jan 2019 14:38:00 -0000 Message-ID: Subject: Re: Fix ICE in get_initial_defs_for_reduction (PR 88567) To: GCC Patches , Richard Sandiford Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-01/txt/msg00306.txt.bz2 On Mon, Jan 7, 2019 at 2:27 PM Richard Sandiford wrote: > > The use of "j" in: > > init = permute_results[number_of_vectors - j - 1]; > > was out-of-sync with the new flat loop structure. Now that all that > reversing is gone, we can just use the result of duplicate_and_interleave > directly. > > The other cases shouldn't be affected by postponing the insertion > of ctor_seq, since gimple_build* appends to the seq without clearing > it first (unlike some of the gimplify routines). > > The ICE is already covered by gcc.dg/vect/pr63379.c. > > Tested on aarch64-linux-gnu (with and without SVE), aarch64_be-elf > and x86_64-linux-gnu. OK to install? OK. Richard. > Richard > > > 2019-01-07 Richard Sandiford > > gcc/ > PR middle-end/88567 > * tree-vect-loop.c (get_initial_defs_for_reduction): Pass the > output vector directly to duplicate_and_interleave instead of > going through a temporary. Postpone insertion of ctor_seq to > the end of the loop. > > Index: gcc/tree-vect-loop.c > =================================================================== > --- gcc/tree-vect-loop.c 2019-01-04 11:39:26.674251052 +0000 > +++ gcc/tree-vect-loop.c 2019-01-07 13:23:22.924449595 +0000 > @@ -4103,7 +4103,6 @@ get_initial_defs_for_reduction (slp_tree > unsigned int group_size = stmts.length (); > unsigned int i; > struct loop *loop; > - auto_vec permute_results; > > vector_type = STMT_VINFO_VECTYPE (stmt_vinfo); > > @@ -4138,6 +4137,7 @@ get_initial_defs_for_reduction (slp_tree > bool constant_p = true; > tree_vector_builder elts (vector_type, nunits, 1); > elts.quick_grow (nunits); > + gimple_seq ctor_seq = NULL; > for (j = 0; j < nunits * number_of_vectors; ++j) > { > tree op; > @@ -4163,7 +4163,6 @@ get_initial_defs_for_reduction (slp_tree > > if (number_of_places_left_in_vector == 0) > { > - gimple_seq ctor_seq = NULL; > tree init; > if (constant_p && !neutral_op > ? multiple_p (TYPE_VECTOR_SUBPARTS (vector_type), nunits) > @@ -4189,16 +4188,11 @@ get_initial_defs_for_reduction (slp_tree > else > { > /* First time round, duplicate ELTS to fill the > - required number of vectors, then cherry pick the > - appropriate result for each iteration. */ > - if (vec_oprnds->is_empty ()) > - duplicate_and_interleave (&ctor_seq, vector_type, elts, > - number_of_vectors, > - permute_results); > - init = permute_results[number_of_vectors - j - 1]; > + required number of vectors. */ > + duplicate_and_interleave (&ctor_seq, vector_type, elts, > + number_of_vectors, *vec_oprnds); > + break; > } > - if (ctor_seq != NULL) > - gsi_insert_seq_on_edge_immediate (pe, ctor_seq); > vec_oprnds->quick_push (init); > > number_of_places_left_in_vector = nunits; > @@ -4207,6 +4201,8 @@ get_initial_defs_for_reduction (slp_tree > constant_p = true; > } > } > + if (ctor_seq != NULL) > + gsi_insert_seq_on_edge_immediate (pe, ctor_seq); > } > >