[0/2] Enable ccmp generation on comparisons leading to equal blocks [PR102793]

Message ID 20251205170158.1742149-1-konstantinos.eleftheriou@vrull.eu
Headers
Series Enable ccmp generation on comparisons leading to equal blocks [PR102793] |

Message

Konstantinos Eleftheriou Dec. 5, 2025, 5:01 p.m. UTC
  This patch series updates the tail-merging pass so that sequential comparisons
leading to equal blocks can be merged, allowing the generation of a ccmp
instruction on targets that support it.

We needed to use ifcombine's `same_phi_args_p` and `recognize_if_then_else`
functions. So, a new header file 'tree-ssa-ifcombine.h', with the functions'
prototypes, has been added and 'static' has been removed from the function
signatures in 'ifcombine'.

Bootstrapped/regtested on AArch64 and x86_64.


Konstantinos Eleftheriou (2):
  ifcombine: Add tree-ssa-ifcombine.h and update function signatures
  tail-merge: Combine sequential comparisons leading to the merged block

 gcc/testsuite/gcc.dg/guality/pr54693-2.c   |   2 +-
 gcc/testsuite/gcc.dg/tree-ssa/pr102793-1.c |  50 ++++
 gcc/testsuite/gcc.dg/tree-ssa/pr102793-2.c |  51 ++++
 gcc/tree-ssa-ifcombine.cc                  |   7 +-
 gcc/tree-ssa-ifcombine.h                   |  28 +++
 gcc/tree-ssa-tail-merge.cc                 | 258 +++++++++++++++++++++
 6 files changed, 392 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr102793-1.c
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr102793-2.c
 create mode 100644 gcc/tree-ssa-ifcombine.h
  

Comments

Konstantinos Eleftheriou Dec. 5, 2025, 5:01 p.m. UTC | #1
That's an alternative for
https://gcc.gnu.org/pipermail/gcc-patches/2024-April/648856.html, based on
the feedback.

Konstantinos.

On Fri, Dec 5, 2025 at 6:53 PM Konstantinos Eleftheriou <
konstantinos.eleftheriou@vrull.eu> wrote:

>
> This patch series updates the tail-merging pass so that sequential
> comparisons
> leading to equal blocks can be merged, allowing the generation of a ccmp
> instruction on targets that support it.
>
> We needed to use ifcombine's `same_phi_args_p` and `recognize_if_then_else`
> functions. So, a new header file 'tree-ssa-ifcombine.h', with the
> functions'
> prototypes, has been added and 'static' has been removed from the function
> signatures in 'ifcombine'.
>
> Bootstrapped/regtested on AArch64 and x86_64.
>
>
> Konstantinos Eleftheriou (2):
>   ifcombine: Add tree-ssa-ifcombine.h and update function signatures
>   tail-merge: Combine sequential comparisons leading to the merged block
>
>  gcc/testsuite/gcc.dg/guality/pr54693-2.c   |   2 +-
>  gcc/testsuite/gcc.dg/tree-ssa/pr102793-1.c |  50 ++++
>  gcc/testsuite/gcc.dg/tree-ssa/pr102793-2.c |  51 ++++
>  gcc/tree-ssa-ifcombine.cc                  |   7 +-
>  gcc/tree-ssa-ifcombine.h                   |  28 +++
>  gcc/tree-ssa-tail-merge.cc                 | 258 +++++++++++++++++++++
>  6 files changed, 392 insertions(+), 4 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr102793-1.c
>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr102793-2.c
>  create mode 100644 gcc/tree-ssa-ifcombine.h
>
> --
> 2.51.1
>
>