From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 4893C3858D34 for ; Fri, 5 Apr 2024 21:28:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4893C3858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4893C3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=63.228.1.57 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712352538; cv=none; b=G8Hfc2Ksc9WkmLpPoWkyoh7IyQt8Qj32yuXiEMgVMAy0fSYd4E9/qf3Beji6I6K1jfAy9rtCI1cl2CReRTY6P9atAqpDi7kzKTJFoybpWuSpb5OiA9PYw1/wi/UqLqli8kwcg/fmXN+WXncvEzzVPRLJvpzoui37q+fc1mY3VjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712352538; c=relaxed/simple; bh=5KO9vd5d81mYC/rFW2noEqfDtfpm7zs/7TQu6MbB6bM=; h=Date:From:To:Subject:Message-ID:Mime-Version; b=I/A7A9H2V3ezPqeKxEvqKZ3wl1QWQdjNdzuTTuq0ATjpcVQF4shZyirM7V2rCl0yOsfoUAt4ugO5jUFPb3So6y1Yph8Ujwi47Tq0/q3b/4QVvHsfmofbpSYxtarVQuFZOUbUOM2C9nz2Br4l5B84UxW66vs2TeKxe9qOk7v+VOg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 435LRtCv019272; Fri, 5 Apr 2024 16:27:55 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 435LRtFL019271; Fri, 5 Apr 2024 16:27:55 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 5 Apr 2024 16:27:54 -0500 From: Segher Boessenkool To: Richard Biener Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek , jeffreyalaw@gmail.com Subject: Re: [PATCH] rtl-optimization/101523 - avoid re-combine after noop 2->2 combination Message-ID: <20240405212754.GL19790@gate.crashing.org> References: <202404031107.433B7hCA019240@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202404031107.433B7hCA019240@gate.crashing.org> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no 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 Wed, Apr 03, 2024 at 01:07:41PM +0200, Richard Biener wrote: > The following avoids re-walking and re-combining the instructions > between i2 and i3 when the pattern of i2 doesn't change. > > Bootstrap and regtest running ontop of a reversal of > r14-9692-g839bc42772ba7a. Please include that in the patch (or series, preferably). > It brings down memory use frmo 9GB to 400MB and compile-time from > 80s to 3.5s. r14-9692-g839bc42772ba7a does better in both metrics > but has shown code generation regressions across acrchitectures. > > OK to revert r14-9692-g839bc42772ba7a? No. The patch solved a very real problem. How does your replacement handle that? You don't say. It looks like it only battles symptoms a bit, instead :-( We had this before: 3->2 combinations that leave an instruction identical to what was there before. This was just a combination with context as well. The only reason this wasn't a huge problem then already was because this is a 3->2 combination, even if it really is a 2->1 one it still is beneficial in all the same cases. But in the new case it can iterate indefinitely -- well not quite, but some polynomial number of times, for a polynomial at least of degree three, possibly more :-( With this patch you need to show combine still is linear. I don't think it is, but some deeper analysis might show it still is. ~ - ~ - ~ What should *really* be done is something that has been on the wish list for decades: an uncse pass. The things that combine no longer works on after my patch are actually 1->1 combinations (which we never do currently, although we probably should); or alternatively, an un-CSE followed by a 2->1 combination. We can do the latter of course, but we need to do an actual uncse first! Somewhere before combine, and then redo a CSE after it. An actual CSE, not doing ten gazillion other things. Segher