Hi Claudiu,

On Fri, Nov 17, 2017 at 03:05:23PM +0000, Claudiu Zissulescu wrote:
> I've found a potential issue when performing CFG operations for hardware 
> loops.
> 
> When a port is using hardware loops (like ARC) makes use of reorg_loops to 
> find and analyze loops that end in loop_end instructions. The very same 
> function can be set to reorder the cfg such that the loop end occurs after 
> the loop start. This task is performed by reoder_loops function which at its 
> turn calls cfg_layout_finalize -> fixup_reoreder_chain -> 
> force_nonfallthru_and_redirect (cfgrtl.c:1476).
> However, the latter is splitting a call and its corresponding 
> CALL_ARG_LOCATION note, leading to an assert in dwarf2out_var_location() at 
> dwarf2out.c:26391. Thus, I've made a hack which patches the 
> force_nonfallthru_and_redirect() function to avoid splitting calls and their 
> note:
> 
> diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
> index ae46908..38a739c 100644
> --- a/gcc/cfgrtl.c
> +++ b/gcc/cfgrtl.c
> @@ -1626,6 +1626,9 @@ force_nonfallthru_and_redirect (edge e, basic_block 
> target, rtx jump_label)
>        else
>         new_head = BB_END (e->src);
>        new_head = NEXT_INSN (new_head);
> +      if (new_head && NOTE_P (new_head)
> +         && NOTE_KIND (new_head) == NOTE_INSN_CALL_ARG_LOCATION)
> +       new_head = NEXT_INSN (new_head);
>  
>        jump_block = create_basic_block (new_head, NULL, e->src);
>        jump_block->count = count;
> 
> I do not know if this is the way forward and I would like to have your input 
> on this subject.

This looks correct.  The same issue is handled similarly elsewhere, too.
Please send the patch to gcc-patches!  (Add a comment though?)

Thanks,


Segher

Reply via email to