---------- Forwarded message ---------- From: Sandeep Maram <[EMAIL PROTECTED]> Date: Thu, Apr 10, 2008 at 11:57 AM Subject: Re: Fusing two loops To: Zdenek Dvorak <[EMAIL PROTECTED]>
Hi Zdenek, I have written this function /* The following function fuses two loops. */ void fuse_loops (struct loop *loop_a, struct loop *loop_b) { debug_loop (loop_a, 10); debug_loop (loop_b, 10); block_stmt_iterator bsi_a = bsi_start (loop_a->header); block_stmt_iterator bsi_b = bsi_last (loop_b->header); bsi_move_before (&bsi_a, &bsi_b); fprintf (stderr, " transferred one statement from loop %d to loop %d ", loop_a->num, loop_b->num); debug_loop (loop_a, 10); debug_loop (loop_b, 10); cancel_loop_tree (loop_a); } It moved one statement from loop_a to loop_b. In the same way I must tranfer all other statements too. I get a internal compiler error at " cancel_loop_tree(loop_a); " . After transfering statemnts from loop_a to loop_b I need to delete the loop_a from current_loops . How can we do this? Thanks, Sandeep. On Fri, Apr 4, 2008 at 7:31 PM, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > Hi, > > > I am trying to fuse two loops in tree level. For that, I am trying to > > transfer statements in the header of one loop to the header of the > > other one. > > The code " http://rafb.net/p/fha0IG57.html " contains the 2 loops. > > After moving a statement from one BB to another BB, do I need to > > update any other info? > > you will need to update SSA form; other than that, just using bsi_move_after > to move the relevant statements should work. > > > > I need to transfer all the statements of bb_6 to bb_3. Can any one > > please tell me what is the exact procedure. > > Can i simply use add_bb_to_loop() and add bb_6 to loop_1 ? > > No; in the case that you describe, moving the statements one by one is > probably the simplest way (you could also move whole basic block, but > it is more complicated, and since you still need to update SSA form, > you would need to process the statements anyway). > > Zdenek >