Hi Richard, On Thu, May 19, 2011 at 5:53 PM, Richard Guenther <richard.guent...@gmail.com> wrote: > On Thu, May 19, 2011 at 5:49 PM, Feng LI <nemoking...@gmail.com> wrote: >> Hi, >> >> I'm trying to outline a function and move all basic-blocks in the function >> to different child functions. Only left 1 newly created bb in the original >> function with newly inserted statements. >> >> But I got an ICE when gcc call remove_ssa_form for the original function. >> I debugged the code, it seems that the ssa names is not removed/released >> in the original function even if they are already moved to the newly created >> child functions (still in the set of cfun->gimple_df->ssa_names). >> >> And in coalesce_ssa_name, it will scan for every ssa name and do >> something there which I thought probably how the ICE is caused. >> >> By moving the basic-block to a newly created child function, I'm using >> move_sese_region_to_fn (). I'm wondering how could I correctly manage >> the ssa names information so that I could solve the problem properly? > > That function isn't designed to work on SSA form. You'd have to extend it > to properly create new SSA names for the new function.
Yes, I agree, this function is only used in omp-low.c which is at the beginning of the passes (before SSA). But there are still something not that clear for me, I checked the code and it seems it'll create the new SSA names for the new function. It created new SSA name in move_block_to_fn, calling the function walk_gimple_stmt (&si, move_stmt_r, move_stmt_op, &wi); Where it has code that will create the SSA names. And the new function's field child_fun->gimple_df->ssa_names will be built at that time. And the ICE happens with the old function. That function still has the ssa name set which corresponding to the removed basic blocks. I've no idea how it'll could be properly handled. Thanks, Feng > > Richard. > >> Here is the back-trace information. >> #0 0x081f3f2e in bitmap_find_bit (head=0x0, bit=4) at ../../gcc/bitmap.c:557 >> #1 0x081f415b in bitmap_set_bit (head=0x0, bit=4) at ../../gcc/bitmap.c:643 >> #2 0x087c5d6d in set_var_live_on_entry (ssa_name=0xb80ae6e0, >> live=0xa2f2808) at ../../gcc/tree-ssa-live.c:984 >> #3 0x087c6448 in calculate_live_ranges (map=0xa34b4a0) at >> ../../gcc/tree-ssa-live.c:1098 >> #4 0x08798322 in coalesce_ssa_name () at ../../gcc/tree-ssa-coalesce.c:1409 >> #5 0x08723191 in remove_ssa_form (perform_ter=0 '\0', sa=0x8f731a8) >> at ../../gcc/tree-outof-ssa.c:909 >> #6 0x08723eb5 in rewrite_out_of_ssa (sa=0x8f731a8) at >> ../../gcc/tree-outof-ssa.c:1143 >> >> Thanks, >> Feng >> >