aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2021-03-12 17:32:42 +0100
committerStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2021-03-23 09:48:01 +0100
commita28cc94a27529b3108ea85be9ef5557a3c95791d (patch)
tree8d29ffd18dc26f9ac50d6c44516c64a3a4af587f
parente54da1b6b39baadded02a28382bb6efb70e687c1 (diff)
downloadgcc-a28cc94a27529b3108ea85be9ef5557a3c95791d.zip
gcc-a28cc94a27529b3108ea85be9ef5557a3c95791d.tar.gz
gcc-a28cc94a27529b3108ea85be9ef5557a3c95791d.tar.bz2
cprop_hardreg: Ensure replacement reg has compatible mode [PR99221]
In addition to the existing check also ask the target whether a replacement register may be accessed in a different mode than it was set before. gcc/ChangeLog: * regcprop.c (find_oldest_value_reg): Ask target whether different mode is fine for replacement register.
-rw-r--r--gcc/regcprop.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index e1342f5..02753a1 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -474,7 +474,8 @@ find_oldest_value_reg (enum reg_class cl, rtx reg, struct value_data *vd)
(set (...) (reg:DI r9))
Replacing r9 with r11 is invalid. */
if (mode != vd->e[regno].mode
- && REG_NREGS (reg) > hard_regno_nregs (regno, vd->e[regno].mode))
+ && (REG_NREGS (reg) > hard_regno_nregs (regno, vd->e[regno].mode)
+ || !REG_CAN_CHANGE_MODE_P (regno, mode, vd->e[regno].mode)))
return NULL_RTX;
for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)