From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82129 invoked by alias); 23 Nov 2015 09:40:11 -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 82118 invoked by uid 89); 23 Nov 2015 09:40:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f175.google.com Received: from mail-yk0-f175.google.com (HELO mail-yk0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 23 Nov 2015 09:40:05 +0000 Received: by ykba77 with SMTP id a77so230196539ykb.2 for ; Mon, 23 Nov 2015 01:40:03 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.13.242.133 with SMTP id b127mr18615653ywf.280.1448271603221; Mon, 23 Nov 2015 01:40:03 -0800 (PST) Received: by 10.37.93.11 with HTTP; Mon, 23 Nov 2015 01:40:03 -0800 (PST) In-Reply-To: <20151120151018.GJ42296@msticlxl57.ims.intel.com> References: <20151118110701.GB42296@msticlxl57.ims.intel.com> <20151120151018.GJ42296@msticlxl57.ims.intel.com> Date: Mon, 23 Nov 2015 09:40:00 -0000 Message-ID: Subject: Re: [PATCH, PR tree-optimization/68327] Compute vectype for live phi nodes when copmputing VF From: Richard Biener To: Ilya Enkovich Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg02660.txt.bz2 On Fri, Nov 20, 2015 at 4:10 PM, Ilya Enkovich wro= te: > On 20 Nov 14:31, Ilya Enkovich wrote: >> 2015-11-20 14:28 GMT+03:00 Richard Biener : >> > On Wed, Nov 18, 2015 at 2:53 PM, Ilya Enkovich wrote: >> >> 2015-11-18 16:44 GMT+03:00 Richard Biener : >> >>> On Wed, Nov 18, 2015 at 12:34 PM, Ilya Enkovich wrote: >> >>>> Hi, >> >>>> >> >>>> When we compute vectypes we skip non-relevant phi nodes. But we pr= ocess non-relevant alive statements and thus may need vectype of non-releva= nt live phi node to compute mask vectype. This patch enables vectype compu= tation for live phi nodes. Botostrapped and regtested on x86_64-unknown-li= nux-gnu. OK for trunk? >> >>> >> >>> Hmm. What breaks if you instead skip all !relevant stmts and not >> >>> compute vectype for life but not relevant ones? We won't ever >> >>> "vectorize" !relevant ones, that is, we don't need their vector type. >> >> >> >> I tried it and got regression in SLP. It expected non-null vectype >> >> for non-releveant but live statement. Regression was in >> >> gcc/gcc/testsuite/gfortran.fortran-torture/execute/pr43390.f90 >> > >> > Because somebody put a vector type check before >> > >> > if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) >> > return false; >> > >> > @@ -7590,6 +7651,9 @@ vectorizable_comparison (gimple *stmt, g >> > tree mask_type; >> > tree mask; >> > >> > + if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) >> > + return false; >> > + >> > if (!VECTOR_BOOLEAN_TYPE_P (vectype)) >> > return false; >> > >> > @@ -7602,8 +7666,6 @@ vectorizable_comparison (gimple *stmt, g >> > ncopies =3D LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits; >> > >> > gcc_assert (ncopies >=3D 1); >> > - if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) >> > - return false; >> > >> > if (STMT_VINFO_DEF_TYPE (stmt_info) !=3D vect_internal_def >> > && !(STMT_VINFO_DEF_TYPE (stmt_info) =3D=3D vect_nested_cycle >> > >> > fixes this particular fallout for me. >> >> I'll try it. > > With this fix it works fine, thanks! Bootstrapped and regtested on x86_6= 4-unknown-linux-gnu. OK for trunk? Ok. Thanks, Richard. > Ilya > -- > gcc/ > > 2015-11-20 Ilya Enkovich > Richard Biener > > * tree-vect-loop.c (vect_determine_vectorization_factor): Don't > compute vectype for non-relevant mask producers. > * gcc/tree-vect-stmts.c (vectorizable_comparison): Check stmt > relevance earlier. > > gcc/testsuite/ > > 2015-11-20 Ilya Enkovich > > * gcc.dg/pr68327.c: New test. > > > diff --git a/gcc/testsuite/gcc.dg/pr68327.c b/gcc/testsuite/gcc.dg/pr6832= 7.c > new file mode 100644 > index 0000000..c3e6a94 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr68327.c > @@ -0,0 +1,15 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O3" } */ > + > +int a, d; > +char b, c; > + > +void > +fn1 () > +{ > + int i =3D 0; > + for (; i < 1; i++) > + d =3D 1; > + for (; b; b++) > + a =3D 1 && (d & b); > +} > diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c > index 80937ec..592372d 100644 > --- a/gcc/tree-vect-loop.c > +++ b/gcc/tree-vect-loop.c > @@ -439,7 +439,8 @@ vect_determine_vectorization_factor (loop_vec_info lo= op_vinfo) > compute a factor. */ > if (TREE_CODE (scalar_type) =3D=3D BOOLEAN_TYPE) > { > - mask_producers.safe_push (stmt_info); > + if (STMT_VINFO_RELEVANT_P (stmt_info)) > + mask_producers.safe_push (stmt_info); > bool_result =3D true; > > if (gimple_code (stmt) =3D=3D GIMPLE_ASSIGN > diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c > index 0f64aaf..3723b26 100644 > --- a/gcc/tree-vect-stmts.c > +++ b/gcc/tree-vect-stmts.c > @@ -7546,6 +7546,9 @@ vectorizable_comparison (gimple *stmt, gimple_stmt_= iterator *gsi, > tree mask_type; > tree mask; > > + if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) > + return false; > + > if (!VECTOR_BOOLEAN_TYPE_P (vectype)) > return false; > > @@ -7558,9 +7561,6 @@ vectorizable_comparison (gimple *stmt, gimple_stmt_= iterator *gsi, > ncopies =3D LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits; > > gcc_assert (ncopies >=3D 1); > - if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) > - return false; > - > if (STMT_VINFO_DEF_TYPE (stmt_info) !=3D vect_internal_def > && !(STMT_VINFO_DEF_TYPE (stmt_info) =3D=3D vect_nested_cycle > && reduc_def))