From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id BC24A3858D38 for ; Thu, 16 May 2024 11:03:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BC24A3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BC24A3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1033 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715857408; cv=none; b=vUHya+g6w4Eqms8KqdlBRYokqnErOwj5vJD/sOIS2GHn9mLXojuJGodA8RhGmWq/aPL1VR+k6qk85NchoACfb6OwtFjc0vWPS+W4uRsxonRBnqszd5M/JNpM+AZ7OTdRQulzppE4DsqeTZTveU6pfn4fOVEZkWs3Wh9K1yuegBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715857408; c=relaxed/simple; bh=zRpgGlF9mqMgcA2GaaBi3aAhU1slue9koZArZUBRNd8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=T1n2p33Ryt4FtGyL4YNMD9azes5eS5mE7os12XHB523O0rk89CxcVWshLJiiPL9AtCtOzaXlAqYqg0yhpN73XWkcVSsn1/eUCFY7SWJCxOcvQ4UA16EwBbPcPhzgHKLQqfcHZ9QEbXxZVFKVzQMWeugnqKCg1ZF9t0OhYPxD2Hg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2b27eec1eb1so58865a91.0 for ; Thu, 16 May 2024 04:03:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715857403; x=1716462203; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Lg8CAq0Va0BDRwHdpm8hokRjlEyKtM8MsSVwlMLFz30=; b=NZOj/tqTPkT2cRa6Z15KVahvWrFeY5rV4N9j/VpEKMxWWlSGG1zNvmI+m2ftSl5C96 pFYdTkrKlaWaUqyA8Drt9ERy5FLDMIYRy2VUo4hiv/iTxg+GO09Cm7+wgpZ/OiN2kmYK HiDt38cKBKYErR4Zla3NHHR3l72ABTAlpjrmXZfbON1QTa2h6WO5BsoV5iw7HB1wzvoI 3AsQF7chR0SphRbG+7aFTaGxEg5Vk0GeAp0mNAV3yPTGtz3f544SlUZMSCY/V0sSpyce qQ3kqXp9mNeD+unZ2hwWJWLmLOxhbyFNwRiTkdtQQiMH1UaqlA9QqBOM7d4DG98Fo5Ze 9iHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715857403; x=1716462203; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Lg8CAq0Va0BDRwHdpm8hokRjlEyKtM8MsSVwlMLFz30=; b=LhKHN2FmyDEBWdv+mzztFy+FEhU/qqeMfRwUOImQCsuHw422TPdy1nJuJpJz5BQnIP DsfyTgj0ShuVxxswDdqZHKtSAF3RtpFSct8rvyb1MAd0DdvTIVsdIMGlHFJ+A5Ii5mRt /j3UYuD0mvAXKl42Ju/cPIMQuzEdMCX8CIqrO+vugOb8ppkDELVjjak7r6knQEEpfWjX 9Ufe8EMneB+IQK3eUZ2e68gz4mcy6h1hbXqGXTEIu27lNfuZ+kGxw3DihGMKKaDbmPvv e10DphVgZckb/fQ9nchE7hapsPqn2vdV68uuGXGt+i38ZW1OJa/XeDqWYXCHsoPT7Cim fU4A== X-Forwarded-Encrypted: i=1; AJvYcCWH6N0fg0tA6rTOL9Z+e3io29k93beOxhnSLbfXZEmTJDrgXzhfUW15U5obbmvEs3ALJjPpwvXASpS97uijOvbbjntGBakyYw== X-Gm-Message-State: AOJu0YwuvRctFf/mTG/IKawpO8zwNzjuUT/srtWnPBzQLTpThYQrhBqJ wkdIPib3EGzmPC4IXnq9RNRcdMc8pJFgGd2tcrmTOGHX+ECT0EZmM6aqLRpq+leu+pk7h2nG5KE pdA8oTWtZiwMSEUWy2mssPSqTS04= X-Google-Smtp-Source: AGHT+IEFFMTapNonrpzJx0vnnOFWPCxvBbb7laZX+dEPPToub4EZ0VidqoeZ55rOCYq2DHJ6dYJ2236pRdeVO0MtudY= X-Received: by 2002:a17:90b:3808:b0:2a2:399f:60e7 with SMTP id 98e67ed59e1d1-2b853c55c38mr15320908a91.23.1715857403280; Thu, 16 May 2024 04:03:23 -0700 (PDT) MIME-Version: 1.0 References: <20240405122625.847311-1-manolis.tsamis@vrull.eu> In-Reply-To: From: Andrew Pinski Date: Thu, 16 May 2024 13:03:09 +0200 Message-ID: Subject: Re: [PATCH] Add extra copy of the ifcombine pass after pre [PR102793] To: Oleg Endo Cc: Richard Biener , Manolis Tsamis , GCC Patches , Andrew Pinski , Philipp Tomsich , Tamar Christina , Jiangning Liu Content-Type: multipart/alternative; boundary="00000000000002050e0618902ffa" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_SHORT,RCVD_IN_DNSWL_NONE,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: --00000000000002050e0618902ffa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 16, 2024, 12:55 PM Oleg Endo wrote: > > On Thu, 2024-05-16 at 10:35 +0200, Richard Biener wrote: > > On Fri, Apr 5, 2024 at 8:14=E2=80=AFPM Andrew Pinski wrote: > > > > > > On Fri, Apr 5, 2024 at 5:28=E2=80=AFAM Manolis Tsamis > wrote: > > > > > > > > If we consider code like: > > > > > > > > if (bar1 =3D=3D x) > > > > return foo(); > > > > if (bar2 !=3D y) > > > > return foo(); > > > > return 0; > > > > > > > > We would like the ifcombine pass to convert this to: > > > > > > > > if (bar1 =3D=3D x || bar2 !=3D y) > > > > return foo(); > > > > return 0; > > > > > > > > The ifcombine pass can handle this transformation but it is ran very > early and > > > > it misses the opportunity because there are two seperate blocks for > foo(). > > > > The pre pass is good at removing duplicate code and blocks and due > to that > > > > running ifcombine again after it can increase the number of > successful > > > > conversions. > > > > > > I do think we should have something similar to re-running > > > ssa-ifcombine but I think it should be much later, like after the loop > > > optimizations are done. > > > Maybe just a simplified version of it (that does the combining and not > > > the optimizations part) included in isel or pass_optimize_widening_mul > > > (which itself should most likely become part of isel or renamed since > > > it handles more than just widening multiply these days). > > > > I've long wished we had a (late?) pass that can also undo if-conversion > > (basically do what RTL expansion would later do). Maybe > > gimple-predicate-analysis.cc (what's used by uninit analysis) can > > represent mixed CFG + if-converted conditions so we can optimize > > it and code-gen the condition in a more optimal manner much like > > we have if-to-switch, switch-conversion and switch-expansion. > > > > That said, I agree that re-running ifcombine should be later. And > there's > > still the old task of splitting tail-merging from PRE (and possibly > making > > it more effective). > > Sorry to butt in, but it might be little bit relevant and caught my > attention. > > I've got this SH patch sitting around > https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D55543 > > The idea is basically to run an additional loop pass after combine and > split1. The main purpose is to hoist constant loads out of loops. Such > constant loads might be formed (in this particular case) during combine > transformations. > > The patch adds a new file gcc/config/sh/sh_loop.cc, which has some boiler- > plate code copy pasted from other places to get the loop pass setup and > going. > > Any thoughts on this way of doing it? > I have been looking at a similar issue on aarch64 for a few cases, csinc and nand. What I decided to do for nand was not depend on combine in the end and create a new infrastructure to expand better to rtl from gimple and maybe even have target specific pattern matching on the gimple level. So the constant is not part of the other instruction. I should have a write up/first draft of an implementation by August time frame or so. The write up will most likely be earlier. Thanks, Andrew > > Best regards, > Oleg Endo > --00000000000002050e0618902ffa--