reload_cse_move2add: Handle trivial single_set:s
commit3991b2f623d22dea19c2558852a96e313a521a44
authorHans-Peter Nilsson <hp@axis.com>
Mon, 22 May 2023 02:12:15 +0000 (22 04:12 +0200)
committerHans-Peter Nilsson <hp@bitrange.com>
Sun, 4 Jun 2023 01:13:03 +0000 (4 03:13 +0200)
treeb0c8f2c3410512aaac9ddae37bdfdb624a247b71
parent8bdfa8a67a54545be1d90c46fb88a676695f25dc
reload_cse_move2add: Handle trivial single_set:s

The reload_cse_move2add part of "postreload" handled only
insns whose PATTERN was a SET.  That excludes insns that
e.g. clobber a flags register, which it does only for
"simplicity".  The patch extends the "simplicity" to most
single_set insns.  For a subset of those insns there's still
an assumption; that the single_set of a PARALLEL insn is the
first element in the PARALLEL.  If the assumption fails,
it's no biggie; the optimization just isn't performed.
Don't let the name deceive you, this optimization doesn't
hit often, but as often (or as rarely) for LRA as for reload
at least on e.g. cris-elf where the biggest effect was seen
in reducing repeated addresses in copies from fixed-address
arrays, like in gcc.c-torture/compile/pr78694.c.

* postreload.cc (move2add_use_add2_insn): Handle
trivial single_sets.  Rename variable PAT to SET.
(move2add_use_add3_insn, reload_cse_move2add): Similar.
gcc/postreload.cc