]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree: Canonical order for ADDR
authorAndrew Pinski <quic_apinski@quicinc.com>
Wed, 14 May 2025 16:01:07 +0000 (09:01 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Thu, 15 May 2025 06:18:26 +0000 (23:18 -0700)
commit649925802f951a7c9bab5dd7a642880442f07981
treed6d0df88ee3b16a3c7922a530512176fbf043015
parentaf7b84d0d02ffa23e4843e9555a888c9e80bd9b5
tree: Canonical order for ADDR

This is the followup based on the review at
https://inbox.sourceware.org/gcc-patches/CAFiYyc3xeG75dsWaF63Zbu5uELPEAEoHwGfoGaVyDWouUJ70Mg@mail.gmail.com/
.
We should put ADDR_EXPR last instead of just is_gimple_invariant_address ones.

Note a few match patterns needed to be updated for this change but we get a decent improvement
as forwprop-38.c is now able to optimize during CCP rather than taking all the way to forwprop.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* fold-const.cc (tree_swap_operands_p): Put ADDR_EXPR last
instead of just is_gimple_invariant_address ones.
* match.pd (`a ptr+ b !=\== ADDR`, `ADDR !=/== ssa_name`):
Move the ADDR to the last operand. Update comment.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/fold-const.cc
gcc/match.pd