This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A latent bug - use of BRANCH_EDGE on trees.
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: dvorakz at suse dot cz, gcc at gcc dot gnu dot org
- Date: Sun, 24 Oct 2004 20:51:23 +0200
- Subject: Re: A latent bug - use of BRANCH_EDGE on trees.
- References: <20041024.140850.02304727.kazu@cs.umass.edu>
Hello,
> I think I found a latent bug.
>
> loopify in cfgloopmanip.c is called from tree_ssa_loop_version and
> unswitch_loop. Of those, tree_ssa_loop_version obviously deals with
> trees in SSA form.
>
> Now, the problem is that loopify uses BRANCH_EDGE. While we are in
> trees, EDGE_FALLTHRU does not make sense for basic blocks ending with
> COND_EXPR. Here is the definition of BRANCH_EDGE.
>
> #define BRANCH_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \
> ? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0))
>
> Any ideas?
yes, this indeed is a problem. There are several solutions:
1) Let the caller pass the edge corresponding to the current
BRANCH_EDGE (switch_bb) to loopify
2) Let BRANCH_EDGE check ir_type and use EDGE_{TRUE,FALSE}_FLAG for
trees.
3) Let EDGE_FALSE_FLAG == EDGE_FALLTHRU
I do not have any special preference here.
Zdenek