> Yeah, rtx_costs (or preferably insn_cost, if that works) seem like the > best way of addressing this. If the target says that register moves are > cheaper than constant moves then it's a feature that CSE & co remove > duplicate constants. The REG_EQUIV note is still useful in those cases > because the note tells IRA/LRA that if the source operand is spilled, > it would be possible to rematerialise the source value (rather than spill > the original source operand and reload it from the stack).
Thanks, that's reasonable. So the mechanism I thought of (match alternatives via REG_EQUIV) doesn't exist and we should generally make sure not to end up in such situations. Thanks Robin