From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id B251C3858C78 for ; Tue, 28 May 2024 07:01:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B251C3858C78 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 B251C3858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::135 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716879682; cv=none; b=GvnuDzXBfIFbBYFbG+ViHRMW++Sdkvr3ES/9H6fYpifedW+6CFS0EePMNZPBJOCObFtml2zECkazHMDs6S0xWEE56ZSuRT+rrgk92hxUvnTkPYMuU96o3On9z2ZQqwX3lFxf7Uy7ZFA69e5FtEj1JCL2/TaW3i0jPXgrDUt+oOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716879682; c=relaxed/simple; bh=DeoB2duvopHIZPMFRV+/LtbuOkF8FGUYMmVPcvBpuNQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=QR7mya4BimKnZ9RJ7dR79Xidgy52lx86NtsXntNk4pbepsiAL+JX9adn6+0Yzr/K+E2Avz9BpYWmZKDJB6uV1DpzGsEZn9p87j9eednmGHIF9sqjKQqFBsZkkIkNuog4+ew+xSE8MK2zIEVnKFwLS263AgG8rAZpp681rFcJnyo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5238b5c07efso567785e87.3 for ; Tue, 28 May 2024 00:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716879679; x=1717484479; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=b2F5EF6KIs7SzSXnaJNo0Zx/CNKSG0DiQiAaCOfg7TU=; b=CxHTkmQYUXn+/dK/4DLOKK15ZdbVxX866m9XA6Ftwxgz8FLRdJerpCHb+YQ/EJm0XE GOu7hIMhay9MnI+DreN8pjJkoBl6pxWPqj4C5pvi/+tFZtXpQShROEFCttJJ1tq/1tQp /TwW5YT8cnJo6Mt02Y0FUY8ObkuWbT7fYvf/byYT3BlfL7zQ3VBgWRdgxcJvsaAMMzKp lLYUhTGzmnL8IzUmpTm907dfdVUnTTd0SpISMqSsO4EQRP0oK1tIgRwh4eS4gw1YgIFG YGyJZkCAoZ8odiRUVFsYIg6ebxx6qIRy24D8TqWjgjlCiYUMAZiGNEnUvxcfGs/3sb2v l8nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716879679; x=1717484479; h=content-transfer-encoding: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=b2F5EF6KIs7SzSXnaJNo0Zx/CNKSG0DiQiAaCOfg7TU=; b=IJUka0qpHhpo3HsD0/3q9sSTrZ8Du9JoehUh3hp9/7wfXHChiFVT4l/eYwFSFRSby8 T1KdUG0sksJ9ffspc9s7smY5y70eG9gqAA1DQyYagjpXUZFmz7EWp+v1Q0Ujgmx5V1Mv JNT/dxAJiUhMi5Ph9WE9C2nBlDzfKs9QCWLlmrojxvtJDPGS+EYErDCUa9z0LV/rEcZ3 HFsHtLF4He0yXTQy1iiZsgfI2WCOuUFOJyvO6KxRmHs9p7EVYMx7XSobCpmKkkTWuVgw M4M3wcLoq/c51tgh6S3E5LMxxlpah4tNo7okkneSlrq94HT3KWd8CrS/qEM+HQ1+9qv8 mfEA== X-Gm-Message-State: AOJu0YyC4tTn+9o1C54ZlGJEVlKvLz5HtzRrIdbENTc8jH2hG3PYaIcT LdvVYPjApnF+gaBjStDMol3BJGQsp/Ov71DqV3M8nNNt5cTMXa5Ik3NaxhKFMlKNXOiNgOcUH93 oWeVH+krFOsLziMwAR57hIJHu5PPzXg== X-Google-Smtp-Source: AGHT+IHQdfnlC9yiTb7OUuvltJAZZQM2gO04na9fwD8851YRguTkJsGvRqiwkMvUmx84mK4wsTIDr+VVLNszXdnd5gI= X-Received: by 2002:a19:5f5b:0:b0:521:9207:189d with SMTP id 2adb3069b0e04-52966e920cfmr5933392e87.65.1716879678788; Tue, 28 May 2024 00:01:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Tue, 28 May 2024 09:01:07 +0200 Message-ID: Subject: Re: [RFC/RFA] [PATCH 08/12] Add a new pass for naive CRC loops detection To: Mariam Arutunian Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.5 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: On Fri, May 24, 2024 at 10:46=E2=80=AFAM Mariam Arutunian wrote: > > This patch adds a new compiler pass aimed at identifying naive CRC implem= entations, > characterized by the presence of a loop calculating a CRC (polynomial lon= g division). > Upon detection of a potential CRC, the pass prints an informational messa= ge. > > Performs CRC optimization if optimization level is >=3D 2, > besides optimizations for size and if fno_gimple_crc_optimization given. > > This pass is added for the detection and optimization of naive CRC implem= entations, > improving the efficiency of CRC-related computations. > > This patch includes only initial fast checks for filtering out non-CRCs, > detected possible CRCs verification and optimization parts will be provid= ed in subsequent patches. Just a few quick questions - I'm waiting for a revision with Jeffs comments 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). I think what this does fits final value replacement which lives in tree-scalar-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, replacing LC PHIs one-by-one should be able to handle this. Richard. > gcc/ > > * Makefile.in (OBJS): Add gimple-crc-optimization.o. > * common.opt (fgimple-crc-optimization): New option. > * doc/invoke.texi (-fgimple-crc-optimization): Add documentation. > * gimple-crc-optimization.cc: New file. > * gimple.cc (set_phi_stmts_not_visited): New function. > (set_gimple_stmts_not_visited): Likewise. > (set_bbs_stmts_not_visited): Likewise. > * gimple.h (set_gimple_stmts_not_visited): New extern function declar= ation. > (set_phi_stmts_not_visited): New extern function declaration. > (set_bbs_stmts_not_visited): New extern function declaration. > * opts.cc (default_options_table): Add OPT_fgimple_crc_optimization. > (enable_fdo_optimizations): Enable gimple-crc-optimization. > * passes.def (pass_crc_optimization): Add new pass. > * timevar.def (TV_GIMPLE_CRC_OPTIMIZATION): New timevar. > * tree-pass.h (make_pass_crc_optimization): New extern function decla= ration. > > Signed-off-by: Mariam Arutunian