On 1/23/19 7:28 PM, Segher Boessenkool wrote:
> Hi Martin,
> 
> On Wed, Jan 23, 2019 at 10:29:40AM +0100, Martin Liška wrote:
>> diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
>> index 172bdf585d0..5dd316efb63 100644
>> --- a/gcc/cfgrtl.c
>> +++ b/gcc/cfgrtl.c
>> @@ -4396,6 +4396,25 @@ cfg_layout_redirect_edge_and_branch (edge e, 
>> basic_block dest)
>>               "Removing crossing jump while redirecting edge form %i to 
>> %i\n",
>>               e->src->index, dest->index);
>>        delete_insn (BB_END (src));
>> +
>> +      /* Unlink a BARRIER that can be still in BB_FOOTER.  */
>> +      rtx_insn *insn = BB_FOOTER (src);
>> +      while (insn != NULL_RTX && !BARRIER_P (insn))
>> +    insn = NEXT_INSN (insn);
>> +
>> +      if (insn != NULL_RTX)
>> +    {
>> +      if (insn == BB_FOOTER (src))
>> +        BB_FOOTER (src) = NULL;
>> +      else
>> +        {
>> +          if (PREV_INSN (insn))
>> +            SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
>> +          if (NEXT_INSN (insn))
>> +            SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
>> +        }
>> +    }
> 
> 
> combine.c has nicer code to do this, in update_cfg_for_uncondjump.  Split
> it out into some common routine?  Something in cfgrtl.c I guess.

Thanks Segher for the advice. I'll do it as soon as Honza will make a review
about the fundament of the patch.

Martin

> 
> 
> Segher
> 

Reply via email to