Message ID | Y6TPrATjd0SO/UrA@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp4962wrn; Thu, 22 Dec 2022 13:45:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXuOcqt9b1sdVfx8fp8GzHL6IiY6dHiK0hkDbYyncd7OgHuMjNmBVM8SCtIilGw9imrztgPm X-Received: by 2002:a17:907:7f24:b0:7c0:e0d9:d1b7 with SMTP id qf36-20020a1709077f2400b007c0e0d9d1b7mr7802561ejc.0.1671745528521; Thu, 22 Dec 2022 13:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671745528; cv=none; d=google.com; s=arc-20160816; b=f1jnboPAzbCbipMVAfzzoOuOllMOIdYk8OBYGDgPG04Eenz47c2Mkmei1xdEGGr7Xn rQbAwgnociEtt5fdZS1UOOy8TSwpQtVavCSJtUh4JIFFwO0qOLm7J/TGEkHLx3tnAROP U5Viwx0ztn2C3+GoQLnuScDHXgCKvJidzdteCVWUTUpJY6hMrvSsl3JB9PQM9eojnI4q YhzSGpejbnJ4w2/CAzki7Kr9t5Nk9IMFUFBwE0uUHzXbe1TymPkNyNWrfjd4KOWCH2e+ pThbMeA5OeJN/q1WpdMLYLvGiwE9NSCijj+Pyrky91zGyyuG8UKVtwn1FYcToES7pzok 1MQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:in-reply-to:mime-version:references:message-id :subject:cc:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=uQhxSrq5C08G797E0t1tFDRxW92mFZ67PcYTt2Ckiss=; b=LGnwxgpW29xCSf42tIKLgc/wull80saoIq5XnvlgepyBJSrM1iK5uHPs2BQjVQweTc dHYDajf0NjbOFApwsjMx3KQHvp04T7h4gkptvf4sANg3fYWXSlUvqF+FFIqtrXQbUpgA Gj4iUMpa7SLNIasyYosuoZYWh7Xcb9ZwKqe+LI8mC6d3ZxUsFVJS7MckXgu5g54mH+Mv I4PZUrwcdmiB/AHq16nyfBfAk3IU939mSMwYGg+kaim0jjD2Ue1NbAJgft1roYjXJAk4 wXCU7Linz7vsI9yW+SuVSWy9jGkUfHmCmFHoGNEcFf+i3ifbagQQiALrVmW+ME3eLOB2 Judw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=XMijw4D+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id be26-20020a0564021a3a00b0046dbf1fd79csi1404664edb.612.2022.12.22.13.45.28 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 13:45:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=XMijw4D+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C78FE38555A1 for <ouuuleilei@gmail.com>; Thu, 22 Dec 2022 21:45:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C78FE38555A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671745501; bh=uQhxSrq5C08G797E0t1tFDRxW92mFZ67PcYTt2Ckiss=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=XMijw4D+PqdyjeJwqY5t36zu/r7MyRLtDkMPeF6ogVkF4PtGyJ9hGGOBOSjq8W5zh A+AmizNRpLsW5SOnRbOTpHeCb3yO/2hYao5AS9rMwqPcNI3zUn4Ex7tVQS4TmKvBqK xnNIcSFqPgzf5L/R5M0eekJgMsSZDQIwo3lOQWN0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id F3C883857C51 for <gcc-patches@gcc.gnu.org>; Thu, 22 Dec 2022 21:44:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F3C883857C51 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-347-1aOCC6RTPBSQUJpKQgJQ9g-1; Thu, 22 Dec 2022 16:44:17 -0500 X-MC-Unique: 1aOCC6RTPBSQUJpKQgJQ9g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E480B85A588; Thu, 22 Dec 2022 21:44:16 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4B4B40C1073; Thu, 22 Dec 2022 21:44:16 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2BMLiD3w1200881 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 22 Dec 2022 22:44:13 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2BMLiCDW1200880; Thu, 22 Dec 2022 22:44:12 +0100 Date: Thu, 22 Dec 2022 22:44:12 +0100 To: Aldy Hernandez <aldyh@redhat.com> Cc: Richard Biener <rguenther@suse.de>, gcc-patches <gcc-patches@gcc.gnu.org>, Andrew MacLeod <amacleod@redhat.com> Subject: [PATCH] phiopt, v2: Adjust instead of reset phires range Message-ID: <Y6TPrATjd0SO/UrA@tucnak> References: <Y6QxsdUy2S2w//u/@tucnak> <nycvar.YFH.7.77.849.2212221131400.5956@jbgna.fhfr.qr> <CAGm3qMXEi0jPpu_MBBHLha2DPjFE9av6RpN7-zGpcLfaro2Y5g@mail.gmail.com> <Y6RTdCmstcJUoFnU@tucnak> <CAGm3qMW=53xZEQfVo2BeQdeHrFegeeD-LfW7LWDBS6Zj-gjF4g@mail.gmail.com> MIME-Version: 1.0 In-Reply-To: <CAGm3qMW=53xZEQfVo2BeQdeHrFegeeD-LfW7LWDBS6Zj-gjF4g@mail.gmail.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752952239180585588?= X-GMAIL-MSGID: =?utf-8?q?1752952239180585588?= |
Series |
phiopt, v2: Adjust instead of reset phires range
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Dec. 22, 2022, 9:44 p.m. UTC
On Thu, Dec 22, 2022 at 08:46:33PM +0100, Aldy Hernandez wrote: > I haven't looked at your problem above, but have you tried using > int_range_max (or even int_range<2>) instead of value_range above? > > value_range is deprecated and uses the legacy anti-range business, > which has a really hard time representing complex ranges, as well as > union/intersecting them. You're right. With int_range_max it works as I expected. And no, floating point isn't possible here. If value_range is right now just the legacy single range or anti-range, then it explains why it didn't work - while on the first testcase we could have anti-range ~[0, 0], on the second case [-128, -1] U [1, 127] is turned into simple legacy [-128, 127]. So, ok for trunk if this passes bootstrap/regtest? 2022-12-22 Jakub Jelinek <jakub@redhat.com> Aldy Hernandez <aldyh@redhat.com> * tree-ssa-phiopt.cc (value_replacement): Instead of resetting phires range info, union it with oarg. Jakub
Comments
LGTM On Thu, Dec 22, 2022, 22:44 Jakub Jelinek <jakub@redhat.com> wrote: > On Thu, Dec 22, 2022 at 08:46:33PM +0100, Aldy Hernandez wrote: > > I haven't looked at your problem above, but have you tried using > > int_range_max (or even int_range<2>) instead of value_range above? > > > > value_range is deprecated and uses the legacy anti-range business, > > which has a really hard time representing complex ranges, as well as > > union/intersecting them. > > You're right. With int_range_max it works as I expected. > And no, floating point isn't possible here. > If value_range is right now just the legacy single range or anti-range, > then it explains why it didn't work - while on the first testcase > we could have anti-range ~[0, 0], on the second case [-128, -1] U [1, 127] > is turned into simple legacy [-128, 127]. > > So, ok for trunk if this passes bootstrap/regtest? > > 2022-12-22 Jakub Jelinek <jakub@redhat.com> > Aldy Hernandez <aldyh@redhat.com> > > * tree-ssa-phiopt.cc (value_replacement): Instead of resetting > phires range info, union it with oarg. > > --- gcc/tree-ssa-phiopt.cc.jj 2022-12-22 12:52:36.588469821 +0100 > +++ gcc/tree-ssa-phiopt.cc 2022-12-22 13:11:51.145060050 +0100 > @@ -1492,11 +1492,25 @@ value_replacement (basic_block cond_bb, > break; > } > if (equal_p) > - /* After the optimization PHI result can have value > - which it couldn't have previously. > - We could instead of resetting it union the range > - info with oarg. */ > - reset_flow_sensitive_info (gimple_phi_result (phi)); > + { > + tree phires = gimple_phi_result (phi); > + if (SSA_NAME_RANGE_INFO (phires)) > + { > + /* After the optimization PHI result can have value > + which it couldn't have previously. */ > + int_range_max r; > + if (get_global_range_query ()->range_of_expr (r, > phires, > + phi)) > + { > + int_range<2> tmp (carg, carg); > + r.union_ (tmp); > + reset_flow_sensitive_info (phires); > + set_range_info (phires, r); > + } > + else > + reset_flow_sensitive_info (phires); > + } > + } > if (equal_p && MAY_HAVE_DEBUG_BIND_STMTS) > { > imm_use_iterator imm_iter; > > > Jakub > >
--- gcc/tree-ssa-phiopt.cc.jj 2022-12-22 12:52:36.588469821 +0100 +++ gcc/tree-ssa-phiopt.cc 2022-12-22 13:11:51.145060050 +0100 @@ -1492,11 +1492,25 @@ value_replacement (basic_block cond_bb, break; } if (equal_p) - /* After the optimization PHI result can have value - which it couldn't have previously. - We could instead of resetting it union the range - info with oarg. */ - reset_flow_sensitive_info (gimple_phi_result (phi)); + { + tree phires = gimple_phi_result (phi); + if (SSA_NAME_RANGE_INFO (phires)) + { + /* After the optimization PHI result can have value + which it couldn't have previously. */ + int_range_max r; + if (get_global_range_query ()->range_of_expr (r, phires, + phi)) + { + int_range<2> tmp (carg, carg); + r.union_ (tmp); + reset_flow_sensitive_info (phires); + set_range_info (phires, r); + } + else + reset_flow_sensitive_info (phires); + } + } if (equal_p && MAY_HAVE_DEBUG_BIND_STMTS) { imm_use_iterator imm_iter;