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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested fix (to be tested and finalized after the weekend):
--- gcc/config/i386/i386.c.jj   2017-09-08 09:13:59.000000000 +0200
+++ gcc/config/i386/i386.c      2017-09-09 17:35:22.365269397 +0200
@@ -8885,7 +8885,7 @@ ix86_use_pseudo_pic_reg (void)

 /* Initialize large model PIC register.  */

-static rtx_code_label *
+static void
 ix86_init_large_pic_reg (unsigned int tmp_regno)
 {
   rtx_code_label *label;
@@ -8902,7 +8902,10 @@ ix86_init_large_pic_reg (unsigned int tm
   emit_insn (gen_set_got_offset_rex64 (tmp_reg, label));
   emit_insn (ix86_gen_add3 (pic_offset_table_rtx,
                            pic_offset_table_rtx, tmp_reg));
-  return label;
+  const char *name = LABEL_NAME (label);
+  PUT_CODE (label, NOTE);
+  NOTE_KIND (label) = NOTE_INSN_DELETED_LABEL;
+  NOTE_DELETED_LABEL_NAME (label) = name;
 }

 /* Create and initialize PIC register if required.  */
@@ -8911,7 +8914,6 @@ ix86_init_pic_reg (void)
 {
   edge entry_edge;
   rtx_insn *seq;
-  rtx_code_label *label = NULL;

   if (!ix86_use_pseudo_pic_reg ())
     return;
@@ -8921,7 +8923,7 @@ ix86_init_pic_reg (void)
   if (TARGET_64BIT)
     {
       if (ix86_cmodel == CM_LARGE_PIC)
-       label = ix86_init_large_pic_reg (R11_REG);
+       ix86_init_large_pic_reg (R11_REG);
       else
        emit_insn (gen_set_got_rex64 (pic_offset_table_rtx));
     }
@@ -8945,22 +8947,6 @@ ix86_init_pic_reg (void)
   entry_edge = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun));
   insert_insn_on_edge (seq, entry_edge);
   commit_one_edge_insertion (entry_edge);
-
-  if (label)
-    {
-      basic_block bb = BLOCK_FOR_INSN (label);
-      rtx_insn *bb_note = PREV_INSN (label);
-      /* If the note preceding the label starts a basic block, and the
-        label is a member of the same basic block, interchange the two.  */
-      if (bb_note != NULL_RTX
-         && NOTE_INSN_BASIC_BLOCK_P (bb_note)
-         && bb != NULL
-         && bb == BLOCK_FOR_INSN (bb_note))
-       {
-         reorder_insns_nobb (bb_note, bb_note, label);
-         BB_HEAD (bb) = label;
-       }
-    }
 }

 /* Initialize a variable CUM of type CUMULATIVE_ARGS
--- gcc/postreload.c.jj 2017-09-08 09:13:54.000000000 +0200
+++ gcc/postreload.c    2017-09-09 17:31:37.360493204 +0200
@@ -409,9 +409,12 @@ reload_cse_simplify_operands (rtx_insn *
       CLEAR_HARD_REG_SET (equiv_regs[i]);

       /* cselib blows up on CODE_LABELs.  Trying to fix that doesn't seem
-        right, so avoid the problem here.  Likewise if we have a constant
-         and the insn pattern doesn't tell us the mode we need.  */
+        right, so avoid the problem here.  Similarly NOTE_INSN_DELETED_LABEL.
+        Likewise if we have a constant and the insn pattern doesn't tell us
+        the mode we need.  */
       if (LABEL_P (recog_data.operand[i])
+         || (NOTE_P (recog_data.operand[i])
+             && NOTE_KIND (recog_data.operand[i]) == NOTE_INSN_DELETED_LABEL)
          || (CONSTANT_P (recog_data.operand[i])
              && recog_data.operand_mode[i] == VOIDmode))
        continue;

Reply via email to