From 88d833253000ecf894d7ab09cee56a50971cb8c7 Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Tue, 28 Apr 2026 08:51:13 -0400 Subject: [PATCH] [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. --- gcc/lra-constraints.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index 9a400c21b7e..d6056cf7acc 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -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);