From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679998079; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=4tj6T3nOA/R0oOpd0O7EMr+SX0mvw8zuj85yQJp4lD4=; b=bSmJZ9nxMqQrZVhOm5vkvzhdCImvm9801HWbXcFA5MhEPbZxaSVuNO6Tn5Wh0DfPuH1yQ+ ZSW2AQ4khaQyxCd/eISJMUlzVJ5Ajok7QBZguqCxPyisX4XhILPU6IsiM0hJvVN/VyYAzU pWy0XxKP4aFTJR7AXcd843bYQ6yQ9T8= 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 From: Jakub Jelinek 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: Reply-To: Jakub Jelinek 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-Type: text/plain; charset=us-ascii 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 List-Id: 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. --- 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); +} Jakub