From patchwork Tue Mar 28 10:07:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 75955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2098505vqo; Tue, 28 Mar 2023 03:08:45 -0700 (PDT) X-Google-Smtp-Source: AKy350YZ7P9CTe2gii/n2ayIhdY71KFIh0I23ePVXm9+QHNQ1vahIg5uxstwFmVl/3qSLEvDaEFP X-Received: by 2002:a17:906:3601:b0:8fc:c566:dc67 with SMTP id q1-20020a170906360100b008fcc566dc67mr16994880ejb.64.1679998125610; Tue, 28 Mar 2023 03:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679998125; cv=none; d=google.com; s=arc-20160816; b=jBsczFKiTlqxvnk6ycDmFXvb+GDNTS5Jj1mNTNbK5KNMIa5zZtiWY1XSO62MKDmJNv CoogUAV2E76JqYq5wHhsfY8luyozteXjbvC1auX7TlACz4uUwmmh9FDxRD55+3naQHM+ 3A6xiJgLvuA6/Ey3kUm8Z9lA8UUI+AUFZQ37R0UOtnRTl1fIQsQpEuXzCCLd/lX0oir7 fKWLNpvvn6QsAOQRxuoaYZIdZTVKMBMfrkKvLwRUfEpmpPv1pycB0VoKVhV+Hk6jJxL3 jRv2zTrIZmf2IhfZ8cD31yiwW5PimehQQMW82axWsqG8oWCwggccXB+wxhIAXZIRbSq4 ydPA== 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=4tj6T3nOA/R0oOpd0O7EMr+SX0mvw8zuj85yQJp4lD4=; b=jzzN+3PDgtdLCmzLO7OZkdirmexqPC94BewdJFqGUyKzXmHUqL4jVNUCzgANqhbsJa O95qpHNFtJLjNwUlcZzKt57AIl8MQOmZOYwIMUMm+NfcFcLAWiPRKgrNzKO4HrXOLH7D djLVjCsuBTBJf+In9upfk5PrfeC6PZYb1rjUs8I/P0Gbs8s3oLQo08t3bqKYFzT3ohUf 2soi64rorfuV6f+FU9wTWHyzNkeDFdhDCmcs3YX9GvZVLK86fJMa+ojE8uLFKboZoDja WssyIw1RDiv6F8tf3SICzvtBOKkjmvGcBjXytCEsGrP1CuuIxT2YEfmpzE60eiuGrfFX EH6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LUKZD6gs; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d12-20020a056402516c00b0048e82d753a3si30796557ede.227.2023.03.28.03.08.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 03:08:45 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LUKZD6gs; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 47E4D3858C1F for ; Tue, 28 Mar 2023 10:08:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47E4D3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679998124; bh=4tj6T3nOA/R0oOpd0O7EMr+SX0mvw8zuj85yQJp4lD4=; 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=LUKZD6gsvoYW8goqZMo+UTSmR6CvkG09J+cytYhs4BlZiLkMrdFvDHm36Zpxj90Mf a4hEPnpVQPQ/AvKtIuVScjTy6am62e/qcmrz5liFbXuch/LpUlxbUeDIUL1Q01xEpa jHItWBvk+RsbczCegNiARdqOlK46o+3Mf4RHIKDs= 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 A77EA3858D39 for ; Tue, 28 Mar 2023 10:07:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A77EA3858D39 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-655-_3xYbQrVPPG_C3hRrhgcGw-1; Tue, 28 Mar 2023 06:07:58 -0400 X-MC-Unique: _3xYbQrVPPG_C3hRrhgcGw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACBAC85A5B1; Tue, 28 Mar 2023 10:07:57 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 717051121330; Tue, 28 Mar 2023 10:07:57 +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 32SA7seV1445489 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 28 Mar 2023 12:07:55 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 32SA7sPh1445488; Tue, 28 Mar 2023 12:07:54 +0200 Date: Tue, 28 Mar 2023 12:07:53 +0200 To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-ssa-math-opts: Move PROP_gimple_opt_math from sincos pass to powcabs [PR109301] Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761605714783926230?= X-GMAIL-MSGID: =?utf-8?q?1761605714783926230?= Hi! On Tue, Mar 28, 2023 at 09:23:23AM +0000, Richard Biener wrote: > But as said, the fix is probably to move the pass property. After looking into it in more detail I agree with you. powcabs is a pass in the spot sincos was happening before, so the only change was defer the sin+cos simplification into cexpi to a later new pass (except for the name moving with it) and none of the canonicalize_math_p () guarded simplification in match.pd seem to rely on those sin+cos -> cexpi simplifications and canonicalize_math_p is the only user of this property. The following patch fixes the testcase, ok for trunk if it passes bootstrap/regtest? Or should I add the match.pd change as well? 2023-03-28 Jakub Jelinek Richard Biener PR tree-optimization/109301 * tree-ssa-math-opts.cc (pass_data_cse_sincos): Change properties_provided from PROP_gimple_opt_math to 0. (pass_data_expand_powcabs): Change properties_provided from 0 to PROP_gimple_opt_math. * gcc.dg/pr109301.c: New test. Jakub --- gcc/tree-ssa-math-opts.cc.jj 2023-03-12 22:36:06.355178083 +0100 +++ gcc/tree-ssa-math-opts.cc 2023-03-28 11:57:36.576699748 +0200 @@ -2237,7 +2237,7 @@ const pass_data pass_data_cse_sincos = OPTGROUP_NONE, /* optinfo_flags */ TV_TREE_SINCOS, /* tv_id */ PROP_ssa, /* properties_required */ - PROP_gimple_opt_math, /* properties_provided */ + 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ TODO_update_ssa, /* todo_flags_finish */ @@ -2331,7 +2331,7 @@ const pass_data pass_data_expand_powcabs OPTGROUP_NONE, /* optinfo_flags */ TV_TREE_POWCABS, /* tv_id */ PROP_ssa, /* properties_required */ - 0, /* properties_provided */ + PROP_gimple_opt_math, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ TODO_update_ssa, /* todo_flags_finish */ --- gcc/testsuite/gcc.dg/pr109301.c.jj 2023-03-28 11:56:34.130615683 +0200 +++ gcc/testsuite/gcc.dg/pr109301.c 2023-03-28 11:56:34.130615683 +0200 @@ -0,0 +1,13 @@ +/* PR tree-optimization/109301 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -ffast-math" } */ + +double x[256]; + +void +foo (void) +{ + for (int i = 0; i < 256; ++i) + for (int j = 0; j < 8; ++j) + x[i] = __builtin_pow (x[i], 0.5); +}