From patchwork Mon Dec 5 21:53:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 702897 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 3tXdnh19CTz9snm for ; Tue, 6 Dec 2016 08:54:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="uKAxeb0Q"; 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:to :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=OZw10 oeld4hTCljrTWatHlImBIoprxO/rfA0dZ7VToDHgo2x4GDzF1DIicX8+TQ0m/tNJ lZrh2aH6k9v81zzdmH8hMt9AIWncGfHPWaTLz2WHM/stvSrxheecTlnC5Go4qDmT lvmq2B69ck5PcI38ysWnzE34OCazjlDqlEmOvo= 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:to :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=9C3YJ70qxxL 5qjqNiNnLLbAXiLw=; b=uKAxeb0Qaxmh2gXZ6yztQyA/Vl4Rs557oU1aOoWbOKG ScEoXxdCAS/DqjXuBurhXWZ2JWpmckyD2iz9P5KzDNPZs0P8WoCkL1I9jn1Q1s/2 S9cUnUC9IBb5vTvE6dG6TuKpKLfJI306OF0GY/qR2qGP3q2ffgU3J9xXsFMR4p5w = Received: (qmail 16192 invoked by alias); 5 Dec 2016 21:54:07 -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 16181 invoked by uid 89); 5 Dec 2016 21:54:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=Hx-languages-length:1398, insufficient, H*UA:Mac, 19217 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Dec 2016 21:53:57 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uB5LrcIj083991 for ; Mon, 5 Dec 2016 16:53:55 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 275cqekq7g-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 05 Dec 2016 16:53:55 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 Dec 2016 14:53:54 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 Dec 2016 14:53:52 -0700 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 3AFD619D801C for ; Mon, 5 Dec 2016 14:53:12 -0700 (MST) Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uB5LrpEI14614988 for ; Mon, 5 Dec 2016 14:53:51 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8F0E78037 for ; Mon, 5 Dec 2016 14:53:51 -0700 (MST) Received: from BigMac.local (unknown [9.80.220.149]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id 97C5C78056 for ; Mon, 5 Dec 2016 14:53:51 -0700 (MST) To: GCC Patches From: Bill Schmidt Subject: [PATCH] Fix PR78646 Date: Mon, 5 Dec 2016 15:53:50 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16120521-0012-0000-0000-0000114FE188 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006200; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000194; SDB=6.00789746; UDB=6.00382376; IPR=6.00567485; BA=6.00004942; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013548; XFM=3.00000011; UTC=2016-12-05 21:53:53 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16120521-0013-0000-0000-000047C155BD Message-Id: <1835079e-3948-a9bf-bb70-c9a15cd6677a@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-05_15:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1612050322 X-IsSubscribed: yes Hi, PR78646 identifies a case where the base expression for a strength-reduced memory reference gets a type of insufficient alignment. This pointed out the fact that we should use the type of the candidate expression for the new base expression in all cases. Patch by Stefan M. Freudenberger. Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Tested with a powerpc64le->x86_64 cross to verify the correct type is now chosen. Committed. Thanks, Bill 2016-12-05 Bill Schmidt Stefan Freudenberger PR tree-optimization/78646 * gimple-ssa-strength-reduction.c (replace_ref): The pointer addition used for the memory base expression should have the type of the candidate. Index: gcc/gimple-ssa-strength-reduction.c =================================================================== --- gcc/gimple-ssa-strength-reduction.c (revision 243264) +++ gcc/gimple-ssa-strength-reduction.c (working copy) @@ -1921,7 +1921,7 @@ replace_ref (tree *expr, slsr_cand_t c) if (align < TYPE_ALIGN (acc_type)) acc_type = build_aligned_type (acc_type, align); - add_expr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (c->base_expr), + add_expr = fold_build2 (POINTER_PLUS_EXPR, c->cand_type, c->base_expr, c->stride); mem_ref = fold_build2 (MEM_REF, acc_type, add_expr, wide_int_to_tree (c->cand_type, c->index));