From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id 0A9383858D20 for ; Thu, 30 May 2024 07:34:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A9383858D20 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 0A9383858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717054450; cv=none; b=vfndyM9BWwnaLYalpEFsczNf7kXaq9NQKTnITgU7goq/qFiJqQKqTQxtd1FWwEkBLVHOSo5QIS5QFtT2RckESshQAbs9V98RU/EVvV2lV9REayuO9cKu2m2+RoOON7w6c0oIvZmAZ734mICf6Sfih8FesNGws0DlFeFuVMW0Ljw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717054450; c=relaxed/simple; bh=Q3WKLhJ5uIiAEasI1kPANjPCShBRwRLj4MYaNe4ppBI=; h=DKIM-Signature:Subject:Mime-Version:From:Date:Message-Id:To; b=p7XNjVNHISIb5fbYL3LVhg6iETXtkaX5lRXLP50XSNX4XXuAA5Q8g2QlRqWiNg5b0PsWj+Ukc9wyVckc836qQPsCxO2ttOUeby9brY61P33cKiHwtauC1tPg+Tvh7UxLtg7xom5Ql8Bezd4oPCk9aYa3gTxvoIgIzN5d1isrPb4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-52ac0c4b62cso583548e87.2 for ; Thu, 30 May 2024 00:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717054446; x=1717659246; darn=gcc.gnu.org; h=to:references:message-id:date:cc:in-reply-to:from:mime-version :subject:content-transfer-encoding:from:to:cc:subject:date :message-id:reply-to; bh=1LSSb1VwRyal6pKHi/rQdBMc5K7L5T5/pG7Sgo5CeQM=; b=CnwDt74TUZvtOpmTUpv/3v3eNgdXaUFZFVGikNLJw5yLt2g6iL78r00HBRoo5P6tGo Tg3SfRU0Ch1fU5msI68UgKGQXXqAXW4QqbIS1HpdJsh+tUa6nTJ40edZ0AVHqEqf8Gvg 6mmiEBxyX74r6kH4GBCzNSFWHvf6M+hPjmMPR5niI2mt3NE42FJ+zBmg6e2LyI7/RZR7 d6uYrAxJGLl/eBvzSwa03MTCov09JqehSm+QfK95Sh8mxh1gHzM2rl4qmIyg2SfgK5Kk cFHY1q0FzjNBZ4OAC9ZcDYmE8naF2NMaBbPwqiCAIdqKDq1AkNN4YE9yFFoxAUP20KuC EJtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717054446; x=1717659246; h=to:references:message-id:date:cc:in-reply-to:from:mime-version :subject:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1LSSb1VwRyal6pKHi/rQdBMc5K7L5T5/pG7Sgo5CeQM=; b=k2tcehbmUXbGirqMuBnyAUnOsP55oXMK8gQbnvpFhINHqc3LxzKvYyOnZiZlPniXXP Y6r5chmqtEUBMM3ZZqF14/mvtUc5zj29pTe51PKxUf6AtREZRZR1M4T39XWFcqTk3EAX rCvpT6J+4QmiK3+1l5QH/KQ7nBaO9qJSmbTwpUdtvuApoxFd1sq/SRUFQf36aDjm5h6E vipYOxaFbyVDGi3LEokWYE2YU6/+XZW3l6d9VY9HVEDp8How2vw9LjSbIZ6t7WG2h1Ha Y2ojh82X/i1voctKBNgvZfRkvjttdmmhpo6IY2OaEfnUJofjZX0TroYY1UM1lc3byIRU nWVQ== X-Gm-Message-State: AOJu0YzWTYsouOL0eiSXDkSTasnh/6YpgZt4Sb7+Te2IVgsueIwqjj7G L8tZ1/Np/Apu9MWLhPbuHc6sBUFZD0qAEKPU+KKy+BpXYhlhaFPGK5SyMA== X-Google-Smtp-Source: AGHT+IHJYtAFIVi1wnBhA8onSM/7gXHhj2mx8/sS4YAzOB1o3FhkPvFyFyq6zDMMnv5Sw1oiktYvkw== X-Received: by 2002:a05:6512:559:b0:52b:4c20:5cec with SMTP id 2adb3069b0e04-52b7d48db86mr797684e87.61.1717054445774; Thu, 30 May 2024 00:34:05 -0700 (PDT) Received: from smtpclient.apple (dynamic-095-118-041-112.95.118.pool.telefonica.de. [95.118.41.112]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5785238bb59sm9510099a12.30.2024.05.30.00.34.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 May 2024 00:34:05 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [RFC/RFA] [PATCH 08/12] Add a new pass for naive CRC loops detection Mime-Version: 1.0 (1.0) X-Apple-Notify-Thread: NO X-Universally-Unique-Identifier: 4E465C4D-8730-458C-973C-86B91AE151CC From: Richard Biener In-Reply-To: <74cde0e6-1013-4ac2-8eb0-d4d9e6ed5861@gmail.com> Cc: gcc-patches@gcc.gnu.org Date: Thu, 30 May 2024 09:33:54 +0200 X-Apple-Message-Smime-Encrypt: NO Message-Id: <800E0E48-AA52-4881-9D2E-4182765F9DE2@gmail.com> References: <74cde0e6-1013-4ac2-8eb0-d4d9e6ed5861@gmail.com> To: Jeff Law X-Mailer: iPhone Mail (21F90) X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: > Am 30.05.2024 um 00:31 schrieb Jeff Law : >=20 > =EF=BB=BF >=20 >> On 5/28/24 1:01 AM, Richard Biener wrote: >>> On Fri, May 24, 2024 at 10:46=E2=80=AFAM Mariam Arutunian >>> wrote: >>>=20 >>> This patch adds a new compiler pass aimed at identifying naive CRC imple= mentations, >>> characterized by the presence of a loop calculating a CRC (polynomial lo= ng division). >>> Upon detection of a potential CRC, the pass prints an informational mess= age. >>>=20 >>> Performs CRC optimization if optimization level is >=3D 2, >>> besides optimizations for size and if fno_gimple_crc_optimization given.= >>>=20 >>> This pass is added for the detection and optimization of naive CRC imple= mentations, >>> improving the efficiency of CRC-related computations. >>>=20 >>> This patch includes only initial fast checks for filtering out non-CRCs,= >>> detected possible CRCs verification and optimization parts will be provi= ded in subsequent patches. >> Just a few quick questions - I'm waiting for a revision with Jeffs commen= ts cleared before having a closer look. The patch does >> nothing but analyze right now, correct? I assume a later patch will >> fill in stuff in ::execute and use the return value of >> loop_may_calculate_crc (it's a bit odd to review such a "split" >> thing). > We split it up on functional chunks. I think if it gets approved it proba= bly should go in atomically since it makes no sense to commit the first pass= recognition filter without the validation step or the validation step witho= ut the codegen step. >=20 > So consider the break down strictly for review convenience. >=20 >=20 >> I think what this does fits final value replacement which lives in tree-s= calar-evolution.cc and works from the loop-closed PHIs, trying >> to replace those. I'm not sure we want to have a separate pass for >> this. Consider a loop calculating two or four CRCs in parallel, replacin= g LC PHIs one-by-one should be able to handle this. > I suspect that'll be quite hard for both the "does this generally look lik= e a CRC loop" code as well as the "validate this is a CRC loop" code. >=20 > Mariam, your thoughts on whether or not those two phases could handle a lo= op with two CRC calculations inside, essentially creating two calls to our n= ew builtins? The key would be to only simulate the use-def cycle from the loop-closed PHI= (plus the loop control of course, but miter/SCEV should be enough there) an= d just replace that LC PHI, leaving loop DCE to DCE. If we really want a separate pass (or utility to work on a single loop) then= we might consider moving some of the final value replacement code that does= n=E2=80=99t work with only SCEV there as well. There=E2=80=99s also special= code in loop distribution for strlen recognition now, not exactly fitting i= n. Note I had patches to do final value replacement on demand from CD-DCE when i= t figures a loop has no side effects besides of its reduction outputs (still= want to pick this up at some point again). Richard=20 > Jeff >=20 >=20