From patchwork Thu Nov 26 13:31:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 549103 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5D8F21402C8 for ; Fri, 27 Nov 2015 00:32:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ZEeGsZJw; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type; q=dns; s=default; b=d4Hhy1KUlMI97pG+zvWtdaDOe8PeG bwQMmw8wwOvBuiIl2BlyfUDT2ofF0KctG8lp3Kr+qqsrKv10WSO8PkS0D9kjQU0Z Ccxg04VVRwvIXz2/E8P6z60NwR8ec7lrjfF3Zh6wnNnWszDeyevlpIFqGh0bV69c HYOOz0/rMosoMg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:in-reply-to:references:date:message-id:mime-version :content-type; s=default; bh=dbncYyEZoBm7sD8ermBIX3NSzbE=; b=ZEe GsZJwRXYkhWPjotH6YpQPPsf579Uf6Z+jqUiWsSgJWfSU7B4lWWOA7cFyH2Lz54z BJGCcgleYHJxndMv6dtLQPIdeDuz//cZH1WV1lxQkiakKIzfwZwH38w16PwShRbz zzsxrZU+BYjzj7jFfibtHEBNaiYt8x/suwkebNFk= Received: (qmail 115312 invoked by alias); 26 Nov 2015 13:32:13 -0000 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 Received: (qmail 115301 invoked by uid 89); 26 Nov 2015 13:32:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Nov 2015 13:32:11 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1a1wed-0006g7-Fn from Thomas_Schwinge@mentor.com ; Thu, 26 Nov 2015 05:32:07 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Thu, 26 Nov 2015 05:32:07 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 827EAC22D5; Thu, 26 Nov 2015 05:32:06 -0800 (PST) From: Thomas Schwinge To: Richard Biener , Jakub Jelinek , Subject: Re: [PATCH] Fix up reduction-1{1, 2} testcases (PR middle-end/68221) In-Reply-To: References: <20151120200645.GM5675@tucnak.redhat.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (i586-pc-linux-gnu) Date: Thu, 26 Nov 2015 14:31:56 +0100 Message-ID: <8737vsrinn.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Mon, 23 Nov 2015 12:13:07 +0100 (CET), Richard Biener wrote: > On Fri, 20 Nov 2015, Jakub Jelinek wrote: > > If C/C++ array section reductions have non-zero (positive) bias, it is > > implemented by declaring a smaller private array and subtracting the bias > > from the start of the private array (because valid code may only dereference > > elements from bias onwards). But, this isn't something that is kosher in > > C/C++ pointer arithmetics and the alias oracle seems to get upset on that. > > So, the following patch fixes that by performing the subtraction on integral > > type instead of p+ -bias. > > So this still does use the biased pointer because you do not > re-write accesses (where you could have applied the biasing to > the indexes / offsets), right? Thus the patch is merely obfuscation > for GCC rather than making it kosher for C/C++ (you still have a > pointer pointing outside of the private array object)? > > I still hope to have a look where the alias oracle gets things > wrong (well, if so by accident at least). I understand this ("have a look where the alias oracle gets things wrong") to have happened in Richi's trunk r230793, ? I've tested that with the original POINTER_PLUS_EXPR code restored and with Richi's r230793 applied, for x86_64 GNU/Linux there is no change for the libgomp.c/reduction-11.c, libgomp.c/reduction-12.c, libgomp.c++/reduction-11.C, libgomp.c++/reduction-12.C test cases (already PASSed), but for 32-bit x86, they now PASS instead of FAILing. That is, I tested with the following (part of r230672) reverted: > > --- gcc/omp-low.c.jj 2015-11-20 12:56:17.000000000 +0100 > > +++ gcc/omp-low.c 2015-11-20 13:44:29.080374051 +0100 > > @@ -4444,11 +4444,13 @@ lower_rec_input_clauses (tree clauses, g > > > > if (!integer_zerop (bias)) > > { > > - bias = fold_convert_loc (clause_loc, sizetype, bias); > > - bias = fold_build1_loc (clause_loc, NEGATE_EXPR, > > - sizetype, bias); > > - x = fold_build2_loc (clause_loc, POINTER_PLUS_EXPR, > > - TREE_TYPE (x), x, bias); > > + bias = fold_convert_loc (clause_loc, pointer_sized_int_node, > > + bias); > > + yb = fold_convert_loc (clause_loc, pointer_sized_int_node, > > + x); > > + yb = fold_build2_loc (clause_loc, MINUS_EXPR, > > + pointer_sized_int_node, yb, bias); > > + x = fold_convert_loc (clause_loc, TREE_TYPE (x), yb); > > yb = create_tmp_var (ptype, name); > > gimplify_assign (yb, x, ilist); > > x = yb; OK to commit the following to trunk? commit 92b0eebfcbe914d3addeb97d4bb33f76a44dbe60 Author: Thomas Schwinge Date: Thu Nov 26 14:21:13 2015 +0100 Restore original POINTER_PLUS_EXPR code PR middle-end/68221 gcc/ * omp-low.c (lower_rec_input_clauses): If C/C++ array reduction has non-zero bias, use pointer plus of negated bias instead of subtracting it in integer type. --- gcc/omp-low.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) Grüße Thomas diff --git gcc/omp-low.c gcc/omp-low.c index 0b44588..927d9d9 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -4451,13 +4451,11 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, if (!integer_zerop (bias)) { - bias = fold_convert_loc (clause_loc, pointer_sized_int_node, - bias); - yb = fold_convert_loc (clause_loc, pointer_sized_int_node, - x); - yb = fold_build2_loc (clause_loc, MINUS_EXPR, - pointer_sized_int_node, yb, bias); - x = fold_convert_loc (clause_loc, TREE_TYPE (x), yb); + bias = fold_convert_loc (clause_loc, sizetype, bias); + bias = fold_build1_loc (clause_loc, NEGATE_EXPR, + sizetype, bias); + x = fold_build2_loc (clause_loc, POINTER_PLUS_EXPR, + TREE_TYPE (x), x, bias); yb = create_tmp_var (ptype, name); gimplify_assign (yb, x, ilist); x = yb;