From patchwork Fri Dec 5 17:01:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantinos Eleftheriou X-Patchwork-Id: 126001 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D82C4CD201D for ; Fri, 5 Dec 2025 16:54:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D82C4CD201D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256 header.s=google header.b=VE2ABcJw X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by sourceware.org (Postfix) with ESMTPS id DCBC24C900C2 for ; Fri, 5 Dec 2025 16:53:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCBC24C900C2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DCBC24C900C2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764953625; cv=none; b=GQktZJxdM/KF+LsmhsAvX5h5hozJJ/oMyi2Pvc3BtDfaQzOJR6LalaBQ1ddahS0yfH6N76NYG/ZUaiHO2SJiPaDnTKcQwDHgnwx7//AzOgf7dbtxPKw5gORODObsiSDEqc+0o80qCVJQPaalsA9YTScCXT7SGUdGB5+YLWhJevw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764953625; c=relaxed/simple; bh=toDazKvUw673x6zBwsJ6JBqH90LTR6EEiaGzi9k3bWI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mspUD/2b655Wu5OdFc8kUxSu3ZkvhYTxiBuGkngCV8VQNzha2a2O1i5tffRw/MdpkJ4gbqErq7e750RX1GG2iGCxWYSkU4NtoKCp0zKOPDxMwCIpCWKZjQ/20ed0dEf7+y6xFmNvs3q5JQqo/lfD7DCpz3PTkU2652PgeZ2xF3s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCBC24C900C2 Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-b734fcbf1e3so510712666b.3 for ; Fri, 05 Dec 2025 08:53:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1764953623; x=1765558423; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qcrz81Z1P1dVCWGKskklINBOIhTrrNwnJI7jU1WcEVM=; b=VE2ABcJwySQRF48VgtuIaKS9Cdq9GJo4hwONeAqddXbyr9yqLKdOHNxnkc16S00UdV yzariJQBlXz/OvFOu66lNFasLI7qOElgDcQkVGBVZYOoUU7GrPfCDZ8NNSYTm44vLPBo 3H4aXL/AJGQgDUJf01nKwp/hVcLAkLT/oRZaoxnPPfDkp+LEe8fSo9UESymyZAr/oV7w d2XKktV2Xl15l6a06ZyUkl8UpsDeRl2yAnfCNKjMFNKwEQiDFhOlEr+uYX7LXE8B/XbN XptsV91iTiFQgAt6goQ0f32c6wrrmatvw/oqqYEsp1KhsgsHWh8VAlCvFi4HioWxIMqV oN1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764953623; x=1765558423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qcrz81Z1P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0Ai8OJw0v5FUkoWya343wzjl4TzZ4wSUMhfunq2DZVzIv3Rb2MbCcVqUTdp1YrVgG2aDw== X-Received: by 2002:a17:907:6e8f:b0:b7a:1be3:a584 with SMTP id a640c23a62f3a-b7a1be3a9e9mr76291666b.65.1764953623559; Fri, 05 Dec 2025 08:53:43 -0800 (PST) Received: from ampereone1.sec.univie.ac.at (ampereone1.sec.univie.ac.at. [131.130.126.106]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b79f4a558b3sm418097266b.69.2025.12.05.08.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 08:53:43 -0800 (PST) From: Konstantinos Eleftheriou To: gcc-patches@gcc.gnu.org, Philipp Tomsich Cc: Richard Biener , Andrew Pinski , Konstantinos Eleftheriou Subject: [PATCH 1/2] ifcombine: Add tree-ssa-ifcombine.h and update function signatures Date: Fri, 5 Dec 2025 18:01:46 +0100 Message-ID: <20251205170158.1742149-2-konstantinos.eleftheriou@vrull.eu> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251205170158.1742149-1-konstantinos.eleftheriou@vrull.eu> References: <20251205170158.1742149-1-konstantinos.eleftheriou@vrull.eu> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org This patch adds the tree-ssa-ifcombine.h header file, with the function declarations for `recognize_if_then_else` and `same_phi_args_p` and removes 'static' from the definitions in tree-ssa-ifcombine.cc, so that they can be used in other passes. gcc/ChangeLog: * tree-ssa-ifcombine.cc (recognize_if_then_else): Removed 'static' and default value for 'succs_any'. (same_phi_args_p): Removed 'static'. * tree-ssa-ifcombine.h: New file. Signed-off-by: Konstantinos Eleftheriou --- gcc/tree-ssa-ifcombine.cc | 7 ++++--- gcc/tree-ssa-ifcombine.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 gcc/tree-ssa-ifcombine.h diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc index 1fff92341982..9dd2119ed87a 100644 --- a/gcc/tree-ssa-ifcombine.cc +++ b/gcc/tree-ssa-ifcombine.cc @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "tm_p.h" #include "ssa.h" #include "tree-pretty-print.h" +#include "tree-ssa-ifcombine.h" /* rtl is needed only because arm back-end requires it for BRANCH_COST. */ #include "fold-const.h" @@ -94,10 +95,10 @@ known_succ_p (basic_block cond_bb) basic-blocks to make the pattern match. If SUCCS_ANY, *THEN_BB and *ELSE_BB will not be filled in, and they will be found to match even if reversed. */ -static bool +bool recognize_if_then_else (basic_block cond_bb, basic_block *then_bb, basic_block *else_bb, - bool succs_any = false) + bool succs_any) { edge t, e; @@ -202,7 +203,7 @@ forwarder_block_to (basic_block bb, basic_block to_bb) BB2 to DEST are the same. This makes the CFG merge point free from side-effects. Return true in this case, else false. */ -static bool +bool same_phi_args_p (basic_block bb1, basic_block bb2, basic_block dest) { edge e1 = find_edge (bb1, dest); diff --git a/gcc/tree-ssa-ifcombine.h b/gcc/tree-ssa-ifcombine.h new file mode 100644 index 000000000000..251039fe77ab --- /dev/null +++ b/gcc/tree-ssa-ifcombine.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016-2025 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_IFCOMBINE_H +#define GCC_TREE_SSA_IFCOMBINE_H + +bool same_phi_args_p (basic_block, basic_block, basic_block); + +bool recognize_if_then_else (basic_block, basic_block *, basic_block *, + bool succs_any = false); + +#endif +