]> git.ipfire.org Git - thirdparty/gcc.git/commit
fab/isel: Move atomic optimizations to isel from fab [PR121762]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Wed, 24 Sep 2025 04:08:24 +0000 (21:08 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 3 Oct 2025 14:29:09 +0000 (07:29 -0700)
commite8a360e79a783250d6466636f6256c75dbb457b2
tree6bcab46779fd1ba73bae1220ef603e67339c0a98
parentd7a3038e2be0bc6e29d077cd7e2534ef3048fd5c
fab/isel: Move atomic optimizations to isel from fab [PR121762]

These atomic optimizations that are currently in fab are really an
instruction selection like optimizations so let's move them to gimple-isel.cc.

Note since this is the last manual optimization left in fab, I have simplified
the code to only fold internal and normal builtins. The next patch will remove all
of fab.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/121762
gcc/ChangeLog:

* gimple-isel.cc (gimple_nop_atomic_bit_test_and_p): New decl.
(gimple_nop_convert): Likewise.
(convert_atomic_bit_not): Moved from tree-ssa-ccp.cc.
(optimize_atomic_bit_test_and): Likewise.
(optimize_atomic_op_fetch_cmp_0): Likewise.
(gimple_isel_builtin_call): New function.
(CASE_ATOMIC): Moved from tree-ssa-ccp.cc.
(CASE_ATOMIC_CMP0): Likewise.
(CASE_ATOMIC_BIT_TEST_AND): Likewise.
(pass_gimple_isel::execute): For calls just call gimple_isel_builtin_call.
* tree-ssa-ccp.cc (convert_atomic_bit_not): Move to gimple-isel.cc.
(gimple_nop_atomic_bit_test_and_p): Likewise.
(gimple_nop_convert): Likewise.
(optimize_atomic_bit_test_and): Likewise.
(optimize_atomic_op_fetch_cmp_0): Likewise.
(pass_fold_builtins::execute): Just call fold_stmt for internal
or normal bultin calls.
(CASE_ATOMIC): Move to gimple-isel.cc.
(CASE_ATOMIC_CMP0): Likewise.
(CASE_ATOMIC_BIT_TEST_AND): Likewise.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/gimple-isel.cc
gcc/tree-ssa-ccp.cc