Hi,

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.

btw, I happened to found this in the bootstrapping for one
experimental local patch, which is considered as impractical.

Bootstrapped/regtested on powerpc64le-linux-gnu P9.

BR,
Kewen

gcc/ChangeLog:

        * ira.c (move_unallocated_pseudos): Check other_reg and skip if
        it isn't set.
diff --git a/gcc/ira.c b/gcc/ira.c
index 89b5df4003d..472fcf52aad 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5111,6 +5111,11 @@ move_unallocated_pseudos (void)
       {
        int idx = i - first_moveable_pseudo;
        rtx other_reg = pseudo_replaced_reg[idx];
+       /* If there is no appropriate pseudo in pseudo_replaced_reg, it
+          means validate_change fails for this new pseudo in function
+          find_moveable_pseudos, then bypass 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.  */

Reply via email to