]> git.ipfire.org Git - thirdparty/gcc.git/commit
ifcombine: For short circuit case, allow 2 convert defining statements [PR85605]
authorAndrew Pinski <quic_apinski@quicinc.com>
Mon, 28 Oct 2024 23:40:34 +0000 (16:40 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Thu, 7 Nov 2024 16:51:55 +0000 (08:51 -0800)
commit2a2e6784074e1f7b679bc09b1a66982bf60645a5
treeae918ceb9b7ce759243676a98194a259a86fccd3
parent684e5ae90b64c3481f8a5cb7b9517daf79c78ab4
ifcombine: For short circuit case, allow 2 convert defining statements [PR85605]

r0-126134-g5d2a9da9a7f7c1 added support for circuiting and combing the ifs
into using either AND or OR. But it only allowed the inner condition
basic block having the conditional only. This changes to allow up to 2 defining
statements as long as they are just integer to integer conversions for
either the lhs or rhs of the conditional.

This should allow to use ccmp on aarch64 and x86_64 (APX) slightly more than before.

Boootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/85605

gcc/ChangeLog:

* tree-ssa-ifcombine.cc (can_combine_bbs_with_short_circuit): New function.
(ifcombine_ifandif): Use can_combine_bbs_with_short_circuit
instead of checking if iterator is one before the last statement.

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/ifcombine-ccmp-1.C: New test.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-7.c: New test.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-8.c: New test.
* gcc.dg/tree-ssa/ssa-ifcombine-ccmp-9.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/g++.dg/tree-ssa/ifcombine-ccmp-1.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-ccmp-9.c [new file with mode: 0644]
gcc/tree-ssa-ifcombine.cc