Fwd: [PATCH][TUPLES] Two simple bug fixes.

Doug Kwan (關振德) dougkwan@google.com
Sun Apr 13 09:33:00 GMT 2008


Here is the patch.

-Doug



 2008-04-13  Doug Kwan  <dougkwan@google.com>

        * gimple-iterator.c (gsi_move_to_bb_end): Use gsi_last_bb
        instead of calling both gsi_last and bb_seq.
        * passes.c (init_optimization_passes): Re-eanble second tail-recursion
        pass.

 Index: gcc/gcc/gimple-iterator.c
 ===================================================================
 --- gcc/gcc/gimple-iterator.c   (revision 134208)
 +++ gcc/gcc/gimple-iterator.c   (working copy)
 @@ -566,7 +566,7 @@ gsi_move_before (gimple_stmt_iterator *f
  void
  gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
  {
 -  gimple_stmt_iterator last = gsi_last (bb_seq (bb));
 +  gimple_stmt_iterator last = gsi_last_bb (bb);

   /* Have to check gsi_end_p because it could be an empty block.  */
   if (!gsi_end_p (last) && is_ctrl_stmt (gsi_stmt (last)))
 Index: gcc/gcc/passes.c
 ===================================================================
 --- gcc/gcc/passes.c    (revision 134209)
 +++ gcc/gcc/passes.c    (working copy)
 @@ -629,8 +629,8 @@ init_optimization_passes (void)
       NEXT_PASS (pass_phi_only_cprop);
       NEXT_PASS (pass_tree_ifcombine);
       NEXT_PASS (pass_phiopt);
 -      NEXT_PASS (pass_tail_recursion);
  #endif
 +      NEXT_PASS (pass_tail_recursion);
       NEXT_PASS (pass_ch);
  #if 0
       NEXT_PASS (pass_stdarg);


 2008/4/13 Rafael Espindola <espindola@google.com>:


> Patch is missing.
 >
 >  2008/4/13 Doug Kwan (關振德) <dougkwan@google.com>:
 >
 >
 > > Hi Diego,
 >  >
 >  >     Could you please review this simple patch?  The first fix is in
 >  >  gsi_move_to_bb_end.  The bug is quite subtle.  In the old code,  if
 >  >  the target bb is empty, bb_seq will be empty and gsi_last will not
 >  >  have the correct bb set.  That causes the moved gimple to have NULL is
 >  >  its bb.  The second fix is to re-enable the second tail recursion
 >  >  pass.  I did not do so when I check in the patch for tree-tailcall.c.
 >  >
 >  >  Thanks.
 >  >
 >  >  -Doug
 >  >
 >
 >
 >
 >  --
 >  Rafael Avila de Espindola
 >
 >  Google Ireland Ltd.
 >  Gordon House
 >  Barrow Street
 >  Dublin 4
 >  Ireland
 >
 >  Registered in Dublin, Ireland
 >  Registration Number: 368047
 >


More information about the Gcc-patches mailing list