https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69648

--- Comment #10 from Bernd Schmidt <bernds at gcc dot gnu.org> ---
A slightly hackish attempt to solve it, by not removing stores to the PIC
register. As far as I can tell we now end up with an unnecessary store to
memory, which is better than an uninitialized load I guess. Haven't yet looked
at what that does to code quality for other code; I'm not massively optimistic.

Index: lra-constraints.c
===================================================================
--- lra-constraints.c   (revision 232689)
+++ lra-constraints.c   (working copy)
@@ -5127,8 +5127,10 @@ update_ebb_live_info (rtx_insn *head, rt
       curr_id = lra_get_insn_recog_data (curr_insn);
       curr_static_id = curr_id->insn_static_data;
       remove_p = false;
-      if ((set = single_set (curr_insn)) != NULL_RTX && REG_P (SET_DEST (set))
+      if ((set = single_set (curr_insn)) != NULL_RTX
+         && REG_P (SET_DEST (set))
          && (regno = REGNO (SET_DEST (set))) >= FIRST_PSEUDO_REGISTER
+         && SET_DEST (set) != pic_offset_table_rtx
          && bitmap_bit_p (&check_only_regs, regno)
          && ! bitmap_bit_p (&live_regs, regno))
        remove_p = true;

Reply via email to