A latent bug - use of BRANCH_EDGE on trees.
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Sun Oct 24 20:05:00 GMT 2004
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
More information about the Gcc
mailing list