[LRA]: Fix mode of subreg of const in the const pool

When LRA puts a constant which is part of subreg, it uses wrong mode for
subreg of the pool memory.  The patch fixes this.

gcc/ChangeLog:

	* lra-constraints.cc (curr_insn_transform): When recreating subreg
	of a const put in pool, use the original subreg mode.
This commit is contained in:
Vladimir N. Makarov
2026-04-28 08:51:13 -04:00
parent 9eb8a18033
commit 88d8332530

View File

@@ -4715,7 +4715,7 @@ curr_insn_transform (bool check_only_p)
char c;
rtx op = *curr_id->operand_loc[i];
rtx subreg = NULL_RTX;
machine_mode mode = curr_operand_mode[i];
machine_mode op_mode = curr_operand_mode[i], mode = op_mode;
if (GET_CODE (op) == SUBREG)
{
@@ -4733,7 +4733,7 @@ curr_insn_transform (bool check_only_p)
change_p = true;
if (subreg != NULL_RTX)
tem = gen_rtx_SUBREG (mode, tem, SUBREG_BYTE (subreg));
tem = gen_rtx_SUBREG (op_mode, tem, SUBREG_BYTE (subreg));
*curr_id->operand_loc[i] = tem;
lra_update_dup (curr_id, i);