From patchwork Thu Aug 5 07:13:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 60928 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 CCC56B70A4 for ; Thu, 5 Aug 2010 17:13:26 +1000 (EST) Received: (qmail 2805 invoked by alias); 5 Aug 2010 07:13:22 -0000 Received: (qmail 2787 invoked by uid 22791); 5 Aug 2010 07:13:20 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL, BAYES_20, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp6.netcologne.de (HELO smtp6.netcologne.de) (194.8.194.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Aug 2010 07:13:12 +0000 Received: from [192.168.0.196] (xdsl-213-168-108-65.netcologne.de [213.168.108.65]) by smtp6.netcologne.de (Postfix) with ESMTP id 40E442A0F3E; Thu, 5 Aug 2010 09:13:09 +0200 (CEST) Subject: [patch, fortran] Further dependency improvements From: Thomas Koenig To: fortran@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Date: Thu, 05 Aug 2010 09:13:08 +0200 Message-ID: <1280992388.4643.13.camel@linux-fd1f.site> Mime-Version: 1.0 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 Hello world, this patch handles another dependency checking improvement. Regression-tested. OK for trunk? Thomas 2010-08-05 Thomas Koenig PR fortran/45159 * dependency.c (check_section_vs_section): Handle cases where the start expression coincides with the lower or upper bound of the array. 2010-08-05 Thomas Koenig PR fortran/45159 * gfortran.dg/dependency_31.f90: New test. Index: dependency.c =================================================================== --- dependency.c (Revision 162848) +++ dependency.c (Arbeitskopie) @@ -1196,13 +1196,33 @@ check_section_vs_section (gfc_array_ref *l_ar, gfc return GFC_DEP_FORWARD; } - /* Check for backward dependencies: - Are the strides the same?. */ + + /* Are the strides the same? */ if ((!l_stride && !r_stride) || (l_stride && r_stride && gfc_dep_compare_expr (l_stride, r_stride) == 0)) { + + if (l_start && IS_ARRAY_EXPLICIT (l_ar->as)) + { + + /* Check for a(low:y:s) vs. a(z:a:s) where a has a lower bound + of low, which is always at least a forward dependence. */ + + if (r_dir == 1 + && gfc_dep_compare_expr (l_start, l_ar->as->lower[n]) == 0) + return GFC_DEP_FORWARD; + + /* Check for a(high:y:-s) vs. a(z:a:-s) where a has a higher bound + of high, which is always at least a forward dependence. */ + + if (r_dir == -1 + && gfc_dep_compare_expr (l_start, l_ar->as->upper[n]) == 0) + return GFC_DEP_FORWARD; + } + + /* From here, check for backards dependencies. */ /* x:y vs. x+1:z. */ if (l_dir == 1 && r_dir == 1 && l_start && r_start