From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114865 invoked by alias); 19 Jun 2015 17:37:21 -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 114855 invoked by uid 89); 19 Jun 2015 17:37:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 Jun 2015 17:37:19 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-1-fCUHzHSOQGOZJoiEhBkxdw-1 Received: from [10.2.207.65] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 19 Jun 2015 18:37:16 +0100 Message-ID: <5584534C.9040406@arm.com> Date: Fri, 19 Jun 2015 17:38:00 -0000 From: Alan Lawrence User-Agent: Thunderbird 2.0.0.24 (X11/20101213) MIME-Version: 1.0 To: Richard Biener CC: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH/RFC] Make loop-header-copying more aggressive, rerun before tree-if-conversion References: <555F4E54.6080600@arm.com> In-Reply-To: X-MC-Unique: fCUHzHSOQGOZJoiEhBkxdw-1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg01357.txt.bz2 Richard Biener wrote: > Apart from Jeffs comment - the usual fix for the undesired > vectorization is to put > a __asm__ volatile (""); in the loop. In vect-strided-a-u16-i4.c, narrowing the scope of the declaration seemed t= o=20 preserve the original intent. I've been able to drop the other testsuite ch= anges. > + /* If any block in the loop has an exit edge, and code after it, it is > + not a do-while loop. */ > + basic_block *body =3D get_loop_body (loop); > + for (unsigned i =3D 0; i < loop->num_nodes; i++) >=20 > wouldn't it be easier to verify that the predecessor of the loop latch > contains the (only) loop exit? It's not guaranteed that the loop latch has only one predecessor. The tests= uite=20 contains quite a few examples, e.g. gcc.c-torture/compile/20011114.c (at -O= 3).=20 However, I've found a simpler (and equivalent) test, as we have the unique = exit=20 edge and it's source already. > Note that single_exit () only works when the loop state has > LOOPS_HAVE_RECORDED_EXITS Hah, thanks - didn't realize that. So using single_exit_p did make pass_ch= =20 behave differently from pass_ch_vect. I've restored the original code for t= he=20 original pass_ch... > I think pass_ch_vect > should be only executed if flag_tree_loop_vectorize is enabled. ...agreed; and handling loop->force_vectorize and loop->dont_vectorize prop= erly=20 required splitting the two phases up more anyway, so I've used clearly-diff= erent=20 predicates in each. > Coding-style wise, can you please move the "common" pass_ch_vect::execute= out > of the pass_ch_vect class? Yes, I've done some reorg, introducing a third base class with the common=20 execute bits calling a virtual method returning bool. > loop_optimizer_init (LOOPS_NORMAL > - | LOOPS_HAVE_RECORDED_EXITS); > + | LOOPS_HAVE_RECORDED_EXITS > + | LOOPS_HAVE_PREHEADERS > + | LOOPS_HAVE_SIMPLE_LATCHES); >=20 > already included in LOOPS_NORMAL. So it is. Thanks! TYVM for the review - I've posted a v2 at=20 https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01355.html . Cheers, Alan