From patchwork Wed Mar 29 13:00:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 744787 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 3vtSZ10PVNz9s2s for ; Thu, 30 Mar 2017 00:01:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="b8btZvzD"; 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:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=apwGT jyGCSHGa+MnODnWEYypFXxV7u/c39m6BZqqCa5twztOr+GdjJmlVVHQIR7EEgE8v sJ8i4d6tIUqSx1q0UB+1yFsMg/3zenZdbV5gXhEqUQIJG/AF5gHgyJG2wn0iB3/c Qsb/5susLIPJ24Ud3JMS1fw+CgrFS1sscC6OpI= 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:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=t6u+NgiOpZ1 Ip/yTKZ2uDW32D2Q=; b=b8btZvzD8juyhMrDNEvsNqDcmMhsZc7wZvHPp9QQQlS prGJyYeCN0c/LZcxMT1TV3l2CqAVDZLsgFqShYTOZsaVgLEGLJyX9bk2D/5DLkkW eZnNGbKtUlbXKiNVVJ2nJEI+NI/U+TJzbDtWaTImrthrLJNH96OATdHSDCs2Tgwk = Received: (qmail 53821 invoked by alias); 29 Mar 2017 13:00:55 -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 53131 invoked by uid 89); 29 Mar 2017 13:00:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Mar 2017 13:00:18 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2TCwcob050375 for ; Wed, 29 Mar 2017 09:00:05 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0b-001b2d01.pphosted.com with ESMTP id 29ft6grgh9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 29 Mar 2017 09:00:04 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Mar 2017 09:00:04 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 29 Mar 2017 09:00:02 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2TD01Bn56623294; Wed, 29 Mar 2017 13:00:02 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B844AE04E; Wed, 29 Mar 2017 08:59:51 -0400 (EDT) Received: from bigmac.rchland.ibm.com (unknown [9.10.86.201]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 73FCFAE043; Wed, 29 Mar 2017 08:59:51 -0400 (EDT) To: GCC Patches Cc: Richard Biener From: Bill Schmidt Subject: [PATCH, committed] PR80158 cleanup (alternate interpretations) Date: Wed, 29 Mar 2017 08:00:01 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17032913-0040-0000-0000-000002FC98EA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006871; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00840324; UDB=6.00413580; IPR=6.00618312; BA=6.00005248; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014851; XFM=3.00000013; UTC=2017-03-29 13:00:03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17032913-0041-0000-0000-000006F0A660 Message-Id: <58b003c4-4c04-922f-89cd-bb79f3c197fc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-29_09:, , 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-1702020001 definitions=main-1703290111 X-IsSubscribed: yes Hi, The fix for PR80158 is technically correct, but not "future-proof" in the sense that someday we may implement more than one alternate interpretation for a strength reduction candidate. This patch cleans that up. Bootstrapped on powerpc64le-unknown-linux-gnu with no regressions, committed. Thanks, Bill 2017-03-29 Bill Schmidt PR tree-optimization/80158 * gimple-ssa-strength-reduction.c (replace_mult_candidate): Handle possible future case of more than one alternate interpretation. (replace_rhs_if_not_dup): Likewise. (replace_one_candidate): Likewise. Index: gcc/gimple-ssa-strength-reduction.c =================================================================== --- gcc/gimple-ssa-strength-reduction.c (revision 246554) +++ gcc/gimple-ssa-strength-reduction.c (working copy) @@ -2086,11 +2086,15 @@ replace_mult_candidate (slsr_cand_t c, tree basis_ tree lhs = gimple_assign_lhs (c->cand_stmt); gassign *copy_stmt = gimple_build_assign (lhs, basis_name); gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); + slsr_cand_t cc = c; gimple_set_location (copy_stmt, gimple_location (c->cand_stmt)); gsi_replace (&gsi, copy_stmt, false); c->cand_stmt = copy_stmt; - if (c->next_interp) - lookup_cand (c->next_interp)->cand_stmt = copy_stmt; + while (cc->next_interp) + { + cc = lookup_cand (cc->next_interp); + cc->cand_stmt = copy_stmt; + } if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = copy_stmt; } @@ -2116,12 +2120,16 @@ replace_mult_candidate (slsr_cand_t c, tree basis_ else { gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); + slsr_cand_t cc = c; gimple_assign_set_rhs_with_ops (&gsi, code, basis_name, bump_tree); update_stmt (gsi_stmt (gsi)); c->cand_stmt = gsi_stmt (gsi); - if (c->next_interp) - lookup_cand (c->next_interp)->cand_stmt = gsi_stmt (gsi); + while (cc->next_interp) + { + cc = lookup_cand (cc->next_interp); + cc->cand_stmt = gsi_stmt (gsi); + } if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = gsi_stmt (gsi); } @@ -3406,11 +3414,15 @@ replace_rhs_if_not_dup (enum tree_code new_code, t || !operand_equal_p (new_rhs2, old_rhs1, 0)))) { gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); + slsr_cand_t cc = c; gimple_assign_set_rhs_with_ops (&gsi, new_code, new_rhs1, new_rhs2); update_stmt (gsi_stmt (gsi)); c->cand_stmt = gsi_stmt (gsi); - if (c->next_interp) - lookup_cand (c->next_interp)->cand_stmt = gsi_stmt (gsi); + while (cc->next_interp) + { + cc = lookup_cand (cc->next_interp); + cc->cand_stmt = gsi_stmt (gsi); + } if (dump_file && (dump_flags & TDF_DETAILS)) return gsi_stmt (gsi); @@ -3514,11 +3526,15 @@ replace_one_candidate (slsr_cand_t c, unsigned i, || !operand_equal_p (rhs2, orig_rhs2, 0)) { gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); + slsr_cand_t cc = c; gimple_assign_set_rhs_with_ops (&gsi, MINUS_EXPR, basis_name, rhs2); update_stmt (gsi_stmt (gsi)); c->cand_stmt = gsi_stmt (gsi); - if (c->next_interp) - lookup_cand (c->next_interp)->cand_stmt = gsi_stmt (gsi); + while (cc->next_interp) + { + cc = lookup_cand (cc->next_interp); + cc->cand_stmt = gsi_stmt (gsi); + } if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = gsi_stmt (gsi); @@ -3537,11 +3553,15 @@ replace_one_candidate (slsr_cand_t c, unsigned i, { gassign *copy_stmt = gimple_build_assign (lhs, basis_name); gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); + slsr_cand_t cc = c; gimple_set_location (copy_stmt, gimple_location (c->cand_stmt)); gsi_replace (&gsi, copy_stmt, false); c->cand_stmt = copy_stmt; - if (c->next_interp) - lookup_cand (c->next_interp)->cand_stmt = copy_stmt; + while (cc->next_interp) + { + cc = lookup_cand (cc->next_interp); + cc->cand_stmt = copy_stmt; + } if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = copy_stmt; @@ -3550,11 +3570,15 @@ replace_one_candidate (slsr_cand_t c, unsigned i, { gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); gassign *cast_stmt = gimple_build_assign (lhs, NOP_EXPR, basis_name); + slsr_cand_t cc = c; gimple_set_location (cast_stmt, gimple_location (c->cand_stmt)); gsi_replace (&gsi, cast_stmt, false); c->cand_stmt = cast_stmt; - if (c->next_interp) - lookup_cand (c->next_interp)->cand_stmt = cast_stmt; + while (cc->next_interp) + { + cc = lookup_cand (cc->next_interp); + cc->cand_stmt = cast_stmt; + } if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = cast_stmt;