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

--- Comment #2 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 8 Aug 2017, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81766
> 
> --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> If contemplating reversion, perhaps:
> --- gcc/function.c.jj   2017-08-07 18:50:09.000000000 +0200
> +++ gcc/function.c      2017-08-08 11:11:25.506239318 +0200
> @@ -6073,17 +6073,16 @@ thread_prologue_and_epilogue_insns (void
>        if (prologue_insn
>           && BLOCK_FOR_INSN (prologue_insn) == NULL)
>         prologue_insn = NULL;
> -      if (split_prologue_insn || prologue_insn)
> -       {
> -         auto_sbitmap blocks (last_basic_block_for_fn (cfun));
> -         bitmap_clear (blocks);
> -         if (split_prologue_insn)
> -           bitmap_set_bit (blocks,
> -                           BLOCK_FOR_INSN (split_prologue_insn)->index);
> -         if (prologue_insn)
> -           bitmap_set_bit (blocks, BLOCK_FOR_INSN (prologue_insn)->index);
> -         find_many_sub_basic_blocks (blocks);
> -       }
> +      auto_sbitmap blocks (last_basic_block_for_fn (cfun));
> +      bitmap_clear (blocks);
> +      if (split_prologue_insn)
> +       bitmap_set_bit (blocks,
> +                       BLOCK_FOR_INSN (split_prologue_insn)->index);
> +      if (prologue_insn)
> +       bitmap_set_bit (blocks, BLOCK_FOR_INSN (prologue_insn)->index);
> +      bitmap_set_bit (blocks, entry_edge->dest->index);
> +      bitmap_set_bit (blocks, orig_entry_edge->dest->index);
> +      find_many_sub_basic_blocks (blocks);
>      }
> 
>    default_rtl_profile ();
> 
> should be safe too (which does what we used to do before and additionally 
> marks
> the new blocks if needed and different from the old ones.
> Can't test it right now though.  And, I really need to debug why we need to
> find_many_sub_basic_blocks when split_prologue_seq is NULL and prologue_seq is
> just
> (note 17 0 0 NOTE_INSN_PROLOGUE_END)
> alone.  Perhaps something inserts insns elsewhere.

find_many_sub_basic_blocks just splits the BB after 
NOTE_INSN_PROLOGUE_END because there's a label there(?).  So
commit_one_edge_insertion fails to split the edge?
There's NOTE_INSN_BASIC_BLOCK before the label and the fn expects
it the other way around(?).  "Fixing" that doesn't help
(NOTE_INSN_PROLOGUE_END after the L12: label)

OTOH maybe add_branch_dependences is just bougus.

The label is inserted by

#1  0x0000000001147df5 in ix86_init_pic_reg ()
    at /space/rguenther/src/svn/gcc-7-branch/gcc/config/i386/i386.c:8513
8513      insert_insn_on_edge (seq, entry_edge);

so maybe that is the real issue.  Either we can't insert labels
that way or we need to handle it?

Don't know enough about RTL internals.

Reply via email to