On 9/7/2022 9:33 AM, Robin Dapp wrote:
Did you did any archeology into this code to see if there was any
history that might shed light on why it doesn't just using the costing
models?
This one was buried under some dust :)
commit 0254c56158b0533600ba9036258c11d377d46adf
Author: John Carr <j...@mit.edu>
Date: Wed Jun 10 06:00:50 1998 +0000
reload1.c (reload_cse_simplify_operands): Do not call gen_rtx_REG
for each alternative.
Wed Jun 10 08:56:27 1998 John Carr <j...@mit.edu>
* reload1.c (reload_cse_simplify_operands): Do not call
gen_rtx_REG
for each alternative. Do not replace a CONST_INT with a REG
unless
the reg is cheaper.
From-SVN: r20402
Back then we didn't have vectors I suppose but apart from that I don't
see a compelling reason not to unconditionally check costs from this.
It seems like we did even more unconditional replacing before it,
including CONST_INTs.
Which is this from the mail archives:
https://gcc.gnu.org/pipermail/gcc-patches/1998-June/000308.html
I would tend to agree that for equal cost that the constant would be
preferred since that should be better from a scheduling/dependency
standpoint. So it seems to me we can drive this purely from a costing
standpoint.
jef