On 8/11/24 21:50, Kewen.Lin wrote:
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index 92b343fa99a..f355c6c6168 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -4742,7 +4742,9 @@ curr_insn_transform (bool check_only_p)
}
*loc = new_reg;
if (type != OP_IN
- && find_reg_note (curr_insn, REG_UNUSED, old) == NULL_RTX)
+ && find_reg_note (curr_insn, REG_UNUSED, old) == NULL_RTX
+ /* OLD can be an equivalent constant here. */
+ && nonimmediate_operand (old, GET_MODE (old)))
{
start_sequence ();
lra_emit_move (type == OP_INOUT ? copy_rtx (old) : old,
new_reg);
Does it look good to you? Or did I miss something here?
The comment looks ok to me.
Also I am agree with Richard Sandiford's remark that CONSTANT_P instead
of nonimmediate_operand would be a better condition. It is more safe.
With CONSTANT_P change, the patch can be already pushed into the trunk.
Thank you.