]> git.ipfire.org Git - thirdparty/gcc.git/commit
isel: Small cleanup of duplicating comparisons
authorAndrew Pinski <quic_apinski@quicinc.com>
Fri, 26 Jul 2024 00:07:28 +0000 (17:07 -0700)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 Jul 2024 17:06:00 +0000 (19:06 +0200)
commitf9caac3ac9c1de99092433c4480a6a59c0078790
tree064c33124e4dec1c7fd2931888a471ce3bb7944a
parent9e74470d64f3fb4086b7f29303b74ae23c39abb8
isel: Small cleanup of duplicating comparisons

This is a small cleanup of the duplicating comparison code.
There is code generation difference but only for -O0 and -fno-tree-ter
(both of which will be fixed in a later patch).
The difference is instead of skipping the first use if the
comparison uses are only in cond_expr we skip the last use.
Also we go through the uses list in the opposite order now too.

The cleanups are the following:
* Don't call has_single_use as we will do the loop anyways
* Change the order of the checks slightly, it is better
  to check for cond_expr earlier
* Use cond_exprs as a stack and pop from it.
  Skipping the top if the use is only from cond_expr.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

* gimple-isel.cc (duplicate_comparison): Rename to ...
(maybe_duplicate_comparison): This. Add check for use here
rather than in its caller.
(pass_gimple_isel::execute): Don't check how many uses the
comparison had and call maybe_duplicate_comparison instead of
duplicate_comparison.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/gimple-isel.cc