From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 0F2583858D32 for ; Mon, 13 Mar 2023 07:39:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0F2583858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 137A91FE07; Mon, 13 Mar 2023 07:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1678693182; h=from:from:reply-to: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=dYhn7tMwMiULigQxHZ95RUE0CwimdOOjsJ5K7OSCOTU=; b=Bpj4JZsc7xXWR0y/EtlLJ18UR1p9nXSk+XndNbVMIZSxRDkT7Kv6T72dvoUVUNf7DwWJu2 7JnCmbGrKESu4AD0BYYBY/Q+yqWEm6tJzYaSNQuC3D7YgCBbN7+3RLth2OSKrrivntvWfK tALYoj8W7BseDoHPoaB7sHqOyNQ1VJc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1678693182; h=from:from:reply-to: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=dYhn7tMwMiULigQxHZ95RUE0CwimdOOjsJ5K7OSCOTU=; b=9xc1wLvFX7G7cZmiH4WJv5zBA1jfhsrIJLXl9gXjhRsyxyo3wQf1mNqgvuI4ILf9X3WhJp NVLYB3ZrKBrtw7Cw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C97912C141; Mon, 13 Mar 2023 07:39:41 +0000 (UTC) Date: Mon, 13 Mar 2023 07:39:41 +0000 (UTC) From: Richard Biener To: Jeff Law cc: gcc-patches@gcc.gnu.org, Jakub Jelinek Subject: Re: [PATCH] tree-optimization/109046 - re-combine complex loads In-Reply-To: <3d77d0e0-540e-0bfe-dcb9-67d502303c52@gmail.com> Message-ID: References: <20230307110836.D4AD8385B514@sourceware.org> <3d77d0e0-540e-0bfe-dcb9-67d502303c52@gmail.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,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: On Sat, 11 Mar 2023, Jeff Law wrote: > > > On 3/7/23 04:08, Richard Biener via Gcc-patches wrote: > > The following addresses PR109046 by adding an optimization to forwprop > > to combine a piecewise complex load to a complex load when there are > > no uses of the components. That's something useful in general and > > easier to do than avoiding the splitting in complex lowering. > Presumably instead of "no uses of the components" you meant to say "no other > uses of the components". Yes, will reword. > > > > The testcase exercises both the manual and the complex lowering case. > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? > > > > Thanks, > > Richard. > > > > PR tree-optimization/109046 > > * tree-ssa-forwprop.cc (pass_forwprop::execute): Combine > > piecewise complex loads. > > > > * gcc.dg/tree-ssa/forwprop-39.c: New testcase. > > --- > > [ ... ] > > + /* Rewrite a component-wise load of a complex to a complex > > + load if the components are not used separately. */ > > + else if (TREE_CODE (rhs) == SSA_NAME > > + && has_single_use (rhs) > Did you really meant to test that RHS is single use? Isn't that the > COMPLEX_EXPR here? It would seem fine to me to allow multiple uses of the > COMPLEX_EXPR itself. Am I missing something? Yeah, rhs is actually rhs1, the first operand of the COMPLEX_EXPR ... > The only conceptual concern I have would be volatile objects. But in that > case were're replacing a piecewise load of the volatile with a single complex > load. That probably better matches what the developer expected anyway. Ah, but good that you notice - we shouldn't do this combination for volatile component loads. I'll adjust accordingly re-test and commit. > So OK as-is if you really wanted the COMPLEX_EXPR to have a single use. Or OK > after removing that test. Thanks, Richard.