|
GCC Middle and Back End API Reference
|

Go to the source code of this file.
Functions | |
| bool | recognize_if_then_else (basic_block, basic_block *, basic_block *, bool succs_any=false) |
| bool | tree_ssa_ifcombine_bb (basic_block) |
| bool recognize_if_then_else | ( | basic_block | cond_bb, |
| basic_block * | then_bb, | ||
| basic_block * | else_bb, | ||
| bool | succs_any ) |
Copyright (C) 2026 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/>.
This pass combines COND_EXPRs to simplify control flow. It currently recognizes bit tests and comparisons in chains that represent logical and or logical or of two COND_EXPRs. It does so by walking basic blocks in a approximate reverse post-dominator order and trying to match CFG patterns that represent logical and or logical or of two COND_EXPRs. Transformations are done if the COND_EXPR conditions match either 1. two single bit tests X & (1 << Yn) (for logical and) 2. two bit tests X & Yn (for logical or) 3. two comparisons X OPn Y (for logical or) To simplify this pass, removing basic blocks and dead code is left to CFG cleanup and DCE.
Recognize a if-then-else CFG pattern starting to match with the COND_BB basic-block containing the COND_EXPR. If !SUCCS_ANY, the condition must not resolve to a constant for a match. Returns true if the pattern matched, false otherwise. In case of a !SUCCS_ANY match, the recognized then end else blocks are stored to *THEN_BB and *ELSE_BB. If *THEN_BB and/or *ELSE_BB are already set, they are required to match the then and else 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.
References EDGE_COUNT, EDGE_SUCC, known_succ_p(), and basic_block_def::succs.
Referenced by apply_clusters(), tree_ssa_ifcombine_bb(), and tree_ssa_ifcombine_bb_1().
| bool tree_ssa_ifcombine_bb | ( | basic_block | inner_cond_bb | ) |
Recognize a CFG pattern and dispatch to the appropriate if-conversion helper. We start with BB as the innermost worker basic-block. Returns true if a transformation was done.
References bb_no_side_effects_p(), changed, forwarder_block_to(), known_succ_p(), NULL, recognize_if_then_else(), same_phi_args_p(), single_pred(), single_pred_p(), single_succ_p(), and tree_ssa_ifcombine_bb_1().
Referenced by tail_merge_optimize().