From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121943 invoked by alias); 20 Nov 2015 10:15:23 -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 121921 invoked by uid 89); 20 Nov 2015 10:15:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 20 Nov 2015 10:15:21 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54907) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1Zziir-0005oi-US for gcc-patches@gnu.org; Fri, 20 Nov 2015 05:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zziio-0007xh-I2 for gcc-patches@gnu.org; Fri, 20 Nov 2015 05:15:17 -0500 Received: from mx2.suse.de ([195.135.220.15]:39725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zziio-0007xC-BE for gcc-patches@gnu.org; Fri, 20 Nov 2015 05:15:14 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D76DEAC1B; Fri, 20 Nov 2015 10:14:42 +0000 (UTC) Date: Fri, 20 Nov 2015 10:15:00 -0000 From: Richard Biener To: Tom de Vries cc: Richard Biener , "gcc-patches@gnu.org" , Jakub Jelinek Subject: Re: [PATCH, PR68373 ] Call scev_const_prop in pass_parallelize_loops::execute In-Reply-To: <564D97F4.1020507@mentor.com> Message-ID: References: <5640BD31.2060602@mentor.com> <5640FB07.6010008@mentor.com> <5649C41A.40403@mentor.com> <564A64B3.7080305@mentor.com> <564B3F69.50600@mentor.com> <564B49F6.308@mentor.com> <564BA844.1010103@mentor.com> <564D97F4.1020507@mentor.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-SW-Source: 2015-11/txt/msg02452.txt.bz2 On Thu, 19 Nov 2015, Tom de Vries wrote: > On 17/11/15 23:20, Tom de Vries wrote: > > [ was: Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def ] > > > > Hi, > > > > Consider test-case test.c, with a use of the final value of the > > iteration variable (return i): > > ... > > unsigned int > > foo (int *a, unsigned int n) > > { > > unsigned int i; > > for (i = 0; i < n; ++i) > > a[i] = 1; > > > > return i; > > } > > ... > > > > Compiled with: > > ... > > $ gcc -S -O2 test.c -ftree-parallelize-loops=2 -fdump-tree-all-details > > ... > > > > Before parloops, we have: > > ... > > : > > # i_12 = PHI <0(3), i_10(5)> > > _5 = (long unsigned int) i_12; > > _6 = _5 * 4; > > _8 = a_7(D) + _6; > > *_8 = 1; > > i_10 = i_12 + 1; > > if (n_4(D) > i_10) > > goto ; > > else > > goto ; > > > > : > > goto ; > > > > : > > # i_14 = PHI > > ... > > > > Parloops will fail because: > > ... > > phi is n_2 = PHI > > arg of phi to exit: value n_4(D) used outside loop > > checking if it a part of reduction pattern: > > FAILED: it is not a part of reduction.... > > ... > > [ note that the phi looks slightly different. In > > gather_scalar_reductions -> vect_analyze_loop_form -> > > vect_analyze_loop_form_1 -> split_loop_exit_edge we split the edge from > > bb4 to bb6. ] > > > > This patch uses scev_const_prop at the start of parloops. > > scev_const_prop first also splits the exit edge, and then replaces the > > phi with a assignment: > > ... > > final value replacement: > > n_2 = PHI > > with > > n_2 = n_4(D); > > ... > > > > This allows parloops to succeed. > > > > And there's a similar story when we compile with -fno-tree-scev-cprop in > > addition. > > > > Bootstrapped and reg-tested on x86_64. > > > > OK for stage3/stage1? > > The patch has been updated to do the final value replacement only for the loop > that parloops is processing, as suggested in review comment at > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02166.html . > > That means the patch is now also required for the kernels patch series. > > Bootstrapped and reg-tested on x86_64. > > OK for stage 3 trunk? Ok. Please mention tree-optimization/68373 in the changelog. Thanks, Richard. > Thanks, > - Tom > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)