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 <[email protected]>
---

 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
+<http://www.gnu.org/licenses/>.  */
+
+#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
+
-- 
2.51.1

Reply via email to