From patchwork Mon Jun 14 15:36:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 55558 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 120F3B7D80 for ; Tue, 15 Jun 2010 01:46:38 +1000 (EST) Received: (qmail 24326 invoked by alias); 14 Jun 2010 15:46:36 -0000 Received: (qmail 24311 invoked by uid 22791); 14 Jun 2010 15:46:34 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jun 2010 15:46:23 +0000 Received: by vws12 with SMTP id 12so7484vws.20 for ; Mon, 14 Jun 2010 08:46:22 -0700 (PDT) Received: by 10.224.70.129 with SMTP id d1mr2358240qaj.357.1276529819216; Mon, 14 Jun 2010 08:36:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.74.18 with HTTP; Mon, 14 Jun 2010 08:36:39 -0700 (PDT) In-Reply-To: References: From: Sebastian Pop Date: Mon, 14 Jun 2010 10:36:39 -0500 Message-ID: Subject: Re: [patch][graphite] Remove sese_adjust_liveout_phis To: GCC Patches , gcc-graphite , Richard Guenther X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, On Sat, Jun 12, 2010 at 02:53, Sebastian Pop wrote: > Hi, > > with the attached patches we no longer need to use the rename_map to > substitute the arguments of the phi nodes created after the code > generated by Graphite.  I committed these patches to the graphite > branch, and I will commit them to trunk once they pass the usual > graphite branch tests. > > The aim is to replace the rename_map with the map that CLooG exposes > for each user statement: associating to a loop level an expression. > The expand_* functions will be replaced by the code generation from a > chrec that is obtained from the original scev by chrec_applying the > loop level -> expression map on each varying loop.  This will then > allow us to remove the call to the IV canonicalization from Graphite. > One of these patches broke 464.h264ref: here is a reduced testcase /* { dg-options "-O3 -fgraphite-identity -ffast-math" } */ typedef enum { I_SLICE, } SliceType; typedef struct { int type; } ImageParameters; extern ImageParameters *img; int A[64], B[64], C[13][8][8], D[13][8][8]; void foo (int q, int temp) { int i, j, k; for(k=0; k<13; k++) for(j=0; j<8; j++) for(i=0; i<8; i++) { if (img->type == I_SLICE) C[k][j][i] = A[temp] << q; D[k][j][i] = B[temp] << q; } } The problem is that img->type is moved out of the loop, making it a parameter of the loop, and then this parameter is copied inside the first loop: p = img->type; loop_1 q = p loop_2 loop_3 if (q == 0) etc. Now because we rewrite the scalar dependence into a data dependence, p = img->type; loop_1 q = p cross_bb_dependence[0] = q loop_2 loop_3 if (cross_bb_dependence[0] == 0) etc. scev is not smart enough to infer that cross_bb_dependence[0] is a parameter defined outside the scop. A possible fix for this is to run copy propagation before Graphite: I don't know how to make the execution of copy_prop conditional to the execution of Graphite. Any suggestions? Thanks, Sebastian diff --git a/gcc/passes.c b/gcc/passes.c index ad444fd..a646d19 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -897,6 +897,7 @@ init_optimization_passes (void) NEXT_PASS (pass_check_data_deps); NEXT_PASS (pass_loop_distribution); NEXT_PASS (pass_linear_transform); + NEXT_PASS (pass_copy_prop); NEXT_PASS (pass_graphite_transforms); { struct opt_pass **p = &pass_graphite_transforms.pass.sub;