aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKewen Lin <linkw@linux.ibm.com>2021-01-10 20:33:23 -0600
committerKewen Lin <linkw@linux.ibm.com>2021-01-10 20:33:23 -0600
commitbcb3065b2ba6efb967c3a34fc34b09726f7579d1 (patch)
treeef68cd0508a8d0dadba9dbaf4c5f6491cae453c6 /gcc
parent366f86bd42939c920bdf2a37e69c66d03ea2d572 (diff)
downloadgcc-bcb3065b2ba6efb967c3a34fc34b09726f7579d1.zip
gcc-bcb3065b2ba6efb967c3a34fc34b09726f7579d1.tar.gz
gcc-bcb3065b2ba6efb967c3a34fc34b09726f7579d1.tar.bz2
ira: Skip some pseudos in move_unallocated_pseudos
This patch is to make move_unallocated_pseudos consistent to what we have in function find_moveable_pseudos, where we record the original pseudo into pseudo_replaced_reg only if validate_change succeeds with newreg. To ensure every unallocated pseudo in move_unallocated_pseudos has expected information, it's better to add a check and skip it if it's unexpected. This avoids possible ICEs in future. gcc/ChangeLog: * ira.c (move_unallocated_pseudos): Check other_reg and skip if it isn't set.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ira.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ira.c b/gcc/ira.c
index eb88f1e..725b0ff 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5111,6 +5111,15 @@ move_unallocated_pseudos (void)
{
int idx = i - first_moveable_pseudo;
rtx other_reg = pseudo_replaced_reg[idx];
+ /* The iterating range [first_moveable_pseudo, last_moveable_pseudo)
+ covers every new pseudo created in find_moveable_pseudos,
+ regardless of the validation with it is successful or not.
+ So we need to skip the pseudos which were used in those failed
+ validations to avoid unexpected DF info and consequent ICE.
+ We only set pseudo_replaced_reg[] when the validation is successful
+ in find_moveable_pseudos, it's enough to check it here. */
+ if (!other_reg)
+ continue;
rtx_insn *def_insn = DF_REF_INSN (DF_REG_DEF_CHAIN (i));
/* The use must follow all definitions of OTHER_REG, so we can
insert the new definition immediately after any of them. */