This is the mail archive of the gcc@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: Questions about tree-cfg.c:remove_forwarder_block.


Hello,

> tree-cfg.c:remove_forwarder_block contains
> 
>   /* If the destination block consists of an nonlocal label, do not merge
>      it.  */
>   label = first_stmt (bb);
>   if (label
>       && TREE_CODE (label) == LABEL_EXPR
>       && DECL_NONLOCAL (LABEL_EXPR_LABEL (label)))
>     return false;
> 
> 1) Is a nonlocal label guaranteed to be the first statement?

I think it is the case (see stmt_starts_bb_p).

>    If not,
>    we need to fix the code above such that it will scan all labels of
>    the given basic block, looking for a nonlocal label just like
>    tree_forwarder_block_p.
> 
> 2) Should "first_stmt (bb)" be "first_stmt (dest)?  The comment and
>    and the code do not agree.  Plus, the code as is is completely
>    subsumed by tree_forwarder_block_p.

It definitely should be "first_stmt (dest)".  The purpose of this piece
of code should have been to prevent nonlocal label to occur in the
middle of the basic block (thus violating the invariant mentioned in 1)
in case we move labels from bb to dest -- which may only happen if there
is an abnormal edge to bb, but no abnormal edge to dest.  This I guess
may happen sometimes.

Zdenek


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