This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cfgcleanup fix


> Hello.
> 
> The following patch fixes updating of liveness information in 
> try_crossjump_to_edge; this fixes Ada bootstrap failure on
> sparc-sun-solaris2.8.
> 
> Bootstrapped and regtested on i686. Also bootstrapped on
> sparc-sun-solaris2.8 (c and ada only).
> 
> Zdenek Dvorak
> 
> Changelog:
> 	* cfgcleanup.c (try_crossjump_to_edge): Fix updating of liveness
> 	information.
> 
..
> *************** try_crossjump_to_edge (mode, e1, e2)
> *** 1442,1469 ****
>   
>     if (GET_CODE (newpos1) == NOTE)
>       newpos1 = NEXT_INSN (newpos1);
> -   last = src1->end;
>   
> !   /* Emit the jump insn.  */
> !   label = block_label (redirect_to);
> !   emit_jump_insn_after (gen_jump (label), src1->end);
> !   JUMP_LABEL (src1->end) = label;
> !   LABEL_NUSES (label)++;
> ! 
> !   /* Delete the now unreachable instructions.  */
> !   delete_insn_chain (newpos1, last);
> ! 
> !   /* Make sure there is a barrier after the new jump.  */
> !   last = next_nonnote_insn (src1->end);
> !   if (!last || GET_CODE (last) != BARRIER)
> !     emit_barrier_after (src1->end);
> ! 
> !   /* Update CFG.  */
> !   while (src1->succ)
> !     remove_edge (src1->succ);
> !   make_single_succ_edge (src1, redirect_to, 0);
>   
> !   update_forwarder_flag (src1);
>   
>     return true;
>   }
> --- 1440,1453 ----
>   
>     if (GET_CODE (newpos1) == NOTE)
>       newpos1 = NEXT_INSN (newpos1);
>   
> !   redirect_from = split_block (src1, PREV_INSN (newpos1))->src;
> !   to_remove = redirect_from->succ->dest;
>   
> !   redirect_edge_and_branch_force (redirect_from->succ, redirect_to);
> !   flow_delete_block (to_remove);
> ! 
> !   update_forwarder_flag (redirect_from);

This looks good. The main purpose for the old code was to avoid creating
and destroying of basic block at time it had linear time complexity.  I
have to check rest of code for similar hacks.

Honza
>   
>     return true;
>   }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]