diff options
author | Alexandre Oliva <oliva@adacore.com> | 2024-11-27 06:27:12 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2024-11-27 06:27:12 -0300 |
commit | 32f6485849c8268f5c7bd8454702bfec369768b1 (patch) | |
tree | 3dcccc5a6737f80e4628c31d7dc396bef10357a3 /gcc/tree-ssa-ifcombine.cc | |
parent | fed871f93c235da8ccba29d7beb715abc1482e59 (diff) | |
download | gcc-32f6485849c8268f5c7bd8454702bfec369768b1.zip gcc-32f6485849c8268f5c7bd8454702bfec369768b1.tar.gz gcc-32f6485849c8268f5c7bd8454702bfec369768b1.tar.bz2 |
ifcombine: skip fallback conjunction on noncontiguous blocks
When everything else fails, if enabled by the target or by a
parameter, and when other requirements are satisfied, ifcombine
generates an AND of both conditions.
That may be good for contiguous conditions, but it's unlikely to be an
optimization when the blocks are separate.
Add contiguity to the set of requirements for this fallback
transformation.
for gcc/ChangeLog
* tree-ssa-ifcombine.cc (ifcombine_ifandif): Avoid fallback
conjunction of noncontiguous conditions.
Diffstat (limited to 'gcc/tree-ssa-ifcombine.cc')
-rw-r--r-- | gcc/tree-ssa-ifcombine.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc index 9a4c6a3..e389b12 100644 --- a/gcc/tree-ssa-ifcombine.cc +++ b/gcc/tree-ssa-ifcombine.cc @@ -973,6 +973,10 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv, gimple_cond_rhs (outer_cond), gimple_bb (outer_cond)))) { + /* Only combine conditions in this fallback case if the blocks are + neighbors. */ + if (single_pred (inner_cond_bb) != outer_cond_bb) + return false; tree t1, t2; bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT; if (param_logical_op_non_short_circuit != -1) |