From patchwork Sat May 23 21:30:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 48916 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A49BC2121F for ; Sat, 23 May 2015 21:31:02 +0000 (UTC) Received: by wgez8 with SMTP id z8sf686200wge.2 for ; Sat, 23 May 2015 14:31:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-original-sender :x-original-authentication-results; bh=b54PLiR89E7sXqC6IPKHkOXolD4F19nnrIDHlmuMOTw=; b=bxAKY/wP9cI2VZ1SCR9Ab6GGYECu7UHXUNHbMr5H5gObRhXGS3JHDccMAtn0Gfh3zI YOcvR59ZfBLkD6TG418AryTdvMa9JBV+ltLOZA2p+TcOq7qy6X3jX9/swcLZb/TagOKC hDFGfLnjUiOuaERXj1YIheg2jC1XjYBF/YaP3IKW/5FXcokQt7lN37QAzCsDMFSs/F4e RVvfOy2aeD5Iy3metJkwGszMRxmJ71ZBusT/FFSCYzFeF83xop5xAxLvktKwj00De5OF 6LW5JsknIBHSUWh8IZ7FlQJmTl3y9O9Z2sbGoKd2GkZnszaXtV9XKPhThg2ZE3Q0SFWU RpoA== X-Gm-Message-State: ALoCoQm6FEc2IzqbUpu+vHpBXcX+SO+VyCdE6e/59pSymLEXCdIRcjymv/VBvoZDuOMBDQVYbCXl X-Received: by 10.112.203.168 with SMTP id kr8mr14512337lbc.10.1432416661935; Sat, 23 May 2015 14:31:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.163 with SMTP id an3ls667070lac.90.gmail; Sat, 23 May 2015 14:31:01 -0700 (PDT) X-Received: by 10.152.7.97 with SMTP id i1mr11486692laa.49.1432416661789; Sat, 23 May 2015 14:31:01 -0700 (PDT) Received: from mail-la0-x235.google.com (mail-la0-x235.google.com. [2a00:1450:4010:c03::235]) by mx.google.com with ESMTPS id lm6si4589338lac.29.2015.05.23.14.31.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 May 2015 14:31:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::235 as permitted sender) client-ip=2a00:1450:4010:c03::235; Received: by labbd9 with SMTP id bd9so31492920lab.2 for ; Sat, 23 May 2015 14:31:01 -0700 (PDT) X-Received: by 10.152.4.137 with SMTP id k9mr11670932lak.29.1432416661435; Sat, 23 May 2015 14:31:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp777743lbb; Sat, 23 May 2015 14:30:59 -0700 (PDT) X-Received: by 10.66.249.198 with SMTP id yw6mr26388502pac.149.1432416659120; Sat, 23 May 2015 14:30:59 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id tw5si9323134pab.90.2015.05.23.14.30.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 May 2015 14:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-398759-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 101092 invoked by alias); 23 May 2015 21:30:44 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 101076 invoked by uid 89); 23 May 2015 21:30:44 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f45.google.com Received: from mail-la0-f45.google.com (HELO mail-la0-f45.google.com) (209.85.215.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 23 May 2015 21:30:34 +0000 Received: by lagv1 with SMTP id v1so31418050lag.3 for ; Sat, 23 May 2015 14:30:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.19.8 with SMTP id a8mr11826362lae.121.1432416630593; Sat, 23 May 2015 14:30:30 -0700 (PDT) Received: by 10.25.205.146 with HTTP; Sat, 23 May 2015 14:30:30 -0700 (PDT) In-Reply-To: References: Date: Sun, 24 May 2015 03:00:30 +0530 Message-ID: Subject: Re: [match-and-simplify] reject expanding operator-list to implicit 'for' From: Prathamesh Kulkarni To: Richard Biener Cc: gcc Patches X-IsSubscribed: yes X-Original-Sender: prathamesh.kulkarni@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::235 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 On 20 May 2015 at 17:39, Prathamesh Kulkarni wrote: > On 20 May 2015 at 17:01, Richard Biener wrote: >> On Wed, 20 May 2015, Prathamesh Kulkarni wrote: >> >>> On 20 May 2015 at 16:17, Prathamesh Kulkarni >>> wrote: >>> > Hi, >>> > This patch rejects expanding operator-list to implicit 'for'. >>> On second thoughts, should we reject expansion of operator-list _only_ >>> if it's mixed with 'for' ? >> >> At least that, yes. >> >>> We could define multiple operator-lists in simplify to be the same as >>> enclosing the simplify in 'for' with number of iterators >>> equal to number of operator-lists. >>> So we could allow >>> (define_operator_list op1 ...) >>> (define_operator_list op2 ...) >>> >>> (simplify >>> (op1 (op2 ... ))) >>> >>> is equivalent to: >>> (for temp1 (op1) >>> temp2 (op2) >>> (simplify >>> (temp1 (temp2 ...)))) >>> >>> I think we have patterns like these in match-builtin.pd in the >>> match-and-simplify branch >>> And reject mixing of 'for' and operator-lists. >>> Admittedly the implicit 'for' behavior is not obvious from the syntax -;( >> >> Hmm, indeed we have for example >> >> /* Optimize pow(1.0,y) = 1.0. */ >> (simplify >> (POW real_onep@0 @1) >> @0) >> >> and I remember wanting that implicit for to make those less ugly. >> >> So can you rework only rejecting it within for? > This patch rejects expanding operator-list inside 'for'. > OK for trunk after bootstrap+testing ? Bootstrap failed with -Werror=parantheses . Applied the attached patch (which just adds { } on if (p && p->is_oper_list)) Thanks, Prathamesh > > Thanks, > Prathamesh >> >> Thanks, >> Richard. >> >> >>> Thanks, >>> Prathamesh >>> > OK for trunk after bootstrap+testing ? >>> > >>> > Thanks, >>> > Prathamesh >>> >>> >> >> -- >> Richard Biener >> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg) Index: genmatch.c =================================================================== --- genmatch.c (revision 223610) +++ genmatch.c (working copy) @@ -2913,7 +2913,12 @@ user_id *p = dyn_cast (op); if (p && p->is_oper_list) - record_operlist (id_tok->src_loc, p); + { + if (active_fors.length() == 0) + record_operlist (id_tok->src_loc, p); + else + fatal_at (id_tok, "operator-list %s cannot be exapnded inside 'for'", id); + } return op; }