The following patch fixes a bug in LRA inheritance found on compiling a big file on s390x. Unfortunately, the bug is very hard to reproduce and the test is too big and can not be included. But even if it were included, checking a correct code generation would be a problem too.

The bug was in undoing inheritance transformation. Not all inheritance pseudo occurrences were removed which resulted in reading a garbage from memory.

The patch was successfully bootstrapped and tested on x86-64.

Committed to the trunk as rev. 212464.

2014-07-11  Vladimir Makarov  <vmaka...@redhat.com>

        * lra-constraints.c (remove_inheritance_pseudos): Process
        destination pseudo too.

Index: lra-constraints.c
===================================================================
--- lra-constraints.c   (revision 212460)
+++ lra-constraints.c   (working copy)
@@ -5697,6 +5697,20 @@ remove_inheritance_pseudos (bitmap remov
                        SUBREG_REG (SET_SRC (set)) = SET_SRC (prev_set);
                      else
                        SET_SRC (set) = SET_SRC (prev_set);
+                     /* As we are finishing with processing the insn
+                        here, check the destination too as it might
+                        inheritance pseudo for another pseudo.  */
+                     if (bitmap_bit_p (remove_pseudos, dregno)
+                         && bitmap_bit_p (&lra_inheritance_pseudos, dregno)
+                         && (restore_regno
+                             = lra_reg_info[dregno].restore_regno) >= 0)
+                       {
+                         if (GET_CODE (SET_DEST (set)) == SUBREG)
+                           SUBREG_REG (SET_DEST (set))
+                             = regno_reg_rtx[restore_regno];
+                         else
+                           SET_DEST (set) = regno_reg_rtx[restore_regno];
+                       }
                      lra_push_insn_and_update_insn_regno_info (curr_insn);
                      lra_set_used_insn_alternative_by_uid
                        (INSN_UID (curr_insn), -1);

Reply via email to