Richard Guenther <richard.guent...@gmail.com> writes:

> On Tue, Sep 14, 2010 at 11:08 AM, Paulo J. Matos <pocma...@gmail.com> wrote:
>>
>> Hello all,
>>
>> I am moving basic blocks around and currently the cfg is getting very,
>> very awkward. My guess is that I am doing something I shouldn't [as
>> usual].
>>
>> For each SWITCH_EXPR I found on the code I generate a CFG which I have
>> to replace with the SWITCH_EXPR. The switch is always the last statement
>> on a basic block, so what I am doing is removing all the edges of the
>> current bb:
>>
>> VEC_truncate (edge, bsi.bb->succs, 0);
>
> You need to use remove_edge, don't mess with internal data structures
> directly.


Thanks, I am now doing:
,----
|     /* Remove all edges from the current bb */                                
                                                                                
                                               
|     for(ei = ei_start(bb->succs); (e = ei_safe_edge(ei)); ei_next(&ei))       
                                                                                
                                               
|         remove_edge(e);
`----

This is based on the comments for FOR_EACH_EDGE in basic_block.h.

-- 
PMatos

Reply via email to