This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] C++-ify and simplify loop iterators


$subject - the following turns

 loop_iterator li;
 FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
   {
     ...
     if ()
       FOR_EACH_LOOP_BREAK;
   }

into

 FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
   {
     ...
     if ()
       break;
   }

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2013-11-19  Richard Biener  <rguenther@suse.de>

	* cfgloop.h (struct loop_iterator): C++-ify, add constructor
	and destructor and make fel_next a member function.
	(fel_next): Transform into ...
	(loop_iterator::next): ... this.
	(fel_init): Transform into ...
	(loop_iterator::loop_iterator): ... this.
	(loop_iterator::~loop_iterator): New.
	(FOR_EACH_LOOP): Remove loop-iterator argument.
	(FOR_EACH_LOOP_BREAK): Remove no longer necessary macro.
	* cfgloop.c, cfgloopmanip.c, config/mn10300/mn10300.c,
	graphite-clast-to-gimple.c, graphite-scop-detection.c,
	graphite-sese-to-poly.c, ipa-inline-analysis.c, ipa-pure-const.c,
	loop-init.c, loop-invariant.c, loop-unroll.c, loop-unswitch.c,
	modulo-sched.c, predict.c, sel-sched-ir.c, tree-cfg.c, tree-data-ref.c,
	tree-if-conv.c, tree-loop-distribution.c, tree-parloops.c,
	tree-predcom.c, tree-scalar-evolution.c, tree-ssa-dce.c,
	tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c,
	tree-ssa-loop-ivopts.c, tree-ssa-loop-manip.c, tree-ssa-loop-niter.c,
	tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c,
	tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vrp.c: Adjust
	uses of FOR_EACH_LOOP and remove loop_iterator variables.  Replace
	FOR_EACH_LOOP_BREAK with break.

Index: gcc/cfgloop.h
===================================================================
*** gcc/cfgloop.h.orig	2013-10-21 10:10:15.000000000 +0200
--- gcc/cfgloop.h	2013-11-19 13:37:18.432818617 +0100
*************** enum li_flags
*** 542,589 ****
  
  /* The iterator for loops.  */
  
! typedef struct
  {
    /* The list of loops to visit.  */
    vec<int> to_visit;
  
    /* The index of the actual loop.  */
    unsigned idx;
! } loop_iterator;
  
! static inline void
! fel_next (loop_iterator *li, loop_p *loop)
  {
    int anum;
  
!   while (li->to_visit.iterate (li->idx, &anum))
      {
!       li->idx++;
!       *loop = get_loop (cfun, anum);
!       if (*loop)
! 	return;
      }
  
!   li->to_visit.release ();
!   *loop = NULL;
  }
  
! static inline void
! fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
  {
    struct loop *aloop;
    unsigned i;
    int mn;
  
!   li->idx = 0;
    if (!current_loops)
      {
!       li->to_visit.create (0);
        *loop = NULL;
        return;
      }
  
!   li->to_visit.create (number_of_loops (cfun));
    mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1;
  
    if (flags & LI_ONLY_INNERMOST)
--- 542,593 ----
  
  /* The iterator for loops.  */
  
! struct loop_iterator
  {
+   loop_iterator (loop_p *loop, unsigned flags);
+   ~loop_iterator ();
+ 
+   inline loop_p next ();
+ 
    /* The list of loops to visit.  */
    vec<int> to_visit;
  
    /* The index of the actual loop.  */
    unsigned idx;
! };
  
! inline loop_p
! loop_iterator::next ()
  {
    int anum;
  
!   while (this->to_visit.iterate (this->idx, &anum))
      {
!       this->idx++;
!       loop_p loop = get_loop (cfun, anum);
!       if (loop)
! 	return loop;
      }
  
!   return NULL;
  }
  
! inline
! loop_iterator::loop_iterator (loop_p *loop, unsigned flags)
  {
    struct loop *aloop;
    unsigned i;
    int mn;
  
!   this->idx = 0;
    if (!current_loops)
      {
!       this->to_visit.create (0);
        *loop = NULL;
        return;
      }
  
!   this->to_visit.create (number_of_loops (cfun));
    mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1;
  
    if (flags & LI_ONLY_INNERMOST)
*************** fel_init (loop_iterator *li, loop_p *loo
*** 592,598 ****
  	if (aloop != NULL
  	    && aloop->inner == NULL
  	    && aloop->num >= mn)
! 	  li->to_visit.quick_push (aloop->num);
      }
    else if (flags & LI_FROM_INNERMOST)
      {
--- 596,602 ----
  	if (aloop != NULL
  	    && aloop->inner == NULL
  	    && aloop->num >= mn)
! 	  this->to_visit.quick_push (aloop->num);
      }
    else if (flags & LI_FROM_INNERMOST)
      {
*************** fel_init (loop_iterator *li, loop_p *loo
*** 605,611 ****
        while (1)
  	{
  	  if (aloop->num >= mn)
! 	    li->to_visit.quick_push (aloop->num);
  
  	  if (aloop->next)
  	    {
--- 609,615 ----
        while (1)
  	{
  	  if (aloop->num >= mn)
! 	    this->to_visit.quick_push (aloop->num);
  
  	  if (aloop->next)
  	    {
*************** fel_init (loop_iterator *li, loop_p *loo
*** 627,633 ****
        while (1)
  	{
  	  if (aloop->num >= mn)
! 	    li->to_visit.quick_push (aloop->num);
  
  	  if (aloop->inner != NULL)
  	    aloop = aloop->inner;
--- 631,637 ----
        while (1)
  	{
  	  if (aloop->num >= mn)
! 	    this->to_visit.quick_push (aloop->num);
  
  	  if (aloop->inner != NULL)
  	    aloop = aloop->inner;
*************** fel_init (loop_iterator *li, loop_p *loo
*** 642,660 ****
  	}
      }
  
!   fel_next (li, loop);
  }
  
! #define FOR_EACH_LOOP(LI, LOOP, FLAGS) \
!   for (fel_init (&(LI), &(LOOP), FLAGS); \
!        (LOOP); \
!        fel_next (&(LI), &(LOOP)))
  
! #define FOR_EACH_LOOP_BREAK(LI) \
!   { \
!     (LI).to_visit.release (); \
!     break; \
!   }
  
  /* The properties of the target.  */
  struct target_cfgloop {
--- 646,664 ----
  	}
      }
  
!   *loop = this->next ();
  }
  
! inline
! loop_iterator::~loop_iterator ()
! {
!   this->to_visit.release ();
! }
  
! #define FOR_EACH_LOOP(LOOP, FLAGS) \
!   for (loop_iterator li(&(LOOP), FLAGS); \
!        (LOOP); \
!        (LOOP) = li.next ())
  
  /* The properties of the target.  */
  struct target_cfgloop {
Index: gcc/cfgloop.c
===================================================================
*** gcc/cfgloop.c.orig	2013-11-19 10:19:53.000000000 +0100
--- gcc/cfgloop.c	2013-11-19 13:38:14.185467458 +0100
*************** flow_loop_dump (const struct loop *loop,
*** 156,162 ****
  void
  flow_loops_dump (FILE *file, void (*loop_dump_aux) (const struct loop *, FILE *, int), int verbose)
  {
-   loop_iterator li;
    struct loop *loop;
  
    if (!current_loops || ! file)
--- 156,161 ----
*************** flow_loops_dump (FILE *file, void (*loop
*** 164,170 ****
  
    fprintf (file, ";; %d loops found\n", number_of_loops (cfun));
  
!   FOR_EACH_LOOP (li, loop, LI_INCLUDE_ROOT)
      {
        flow_loop_dump (loop, file, loop_dump_aux, verbose);
      }
--- 163,169 ----
  
    fprintf (file, ";; %d loops found\n", number_of_loops (cfun));
  
!   FOR_EACH_LOOP (loop, LI_INCLUDE_ROOT)
      {
        flow_loop_dump (loop, file, loop_dump_aux, verbose);
      }
*************** disambiguate_multiple_latches (struct lo
*** 767,776 ****
  void
  disambiguate_loops_with_multiple_latches (void)
  {
-   loop_iterator li;
    struct loop *loop;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        if (!loop->latch)
  	disambiguate_multiple_latches (loop);
--- 766,774 ----
  void
  disambiguate_loops_with_multiple_latches (void)
  {
    struct loop *loop;
  
!   FOR_EACH_LOOP (loop, 0)
      {
        if (!loop->latch)
  	disambiguate_multiple_latches (loop);
*************** verify_loop_structure (void)
*** 1327,1333 ****
    int err = 0;
    edge e;
    unsigned num = number_of_loops (cfun);
-   loop_iterator li;
    struct loop_exit *exit, *mexit;
    bool dom_available = dom_info_available_p (CDI_DOMINATORS);
    sbitmap visited;
--- 1325,1330 ----
*************** verify_loop_structure (void)
*** 1369,1375 ****
    visited = sbitmap_alloc (last_basic_block);
    bitmap_clear (visited);
    bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        unsigned n;
  
--- 1366,1372 ----
    visited = sbitmap_alloc (last_basic_block);
    bitmap_clear (visited);
    bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        unsigned n;
  
*************** verify_loop_structure (void)
*** 1416,1422 ****
    sbitmap_free (visited);
  
    /* Check headers and latches.  */
!   FOR_EACH_LOOP (li, loop, 0)
      {
        i = loop->num;
        if (loop->header == NULL)
--- 1413,1419 ----
    sbitmap_free (visited);
  
    /* Check headers and latches.  */
!   FOR_EACH_LOOP (loop, 0)
      {
        i = loop->num;
        if (loop->header == NULL)
*************** verify_loop_structure (void)
*** 1536,1542 ****
      }
  
    /* Check the recorded loop exits.  */
!   FOR_EACH_LOOP (li, loop, 0)
      {
        if (!loop->exits || loop->exits->e != NULL)
  	{
--- 1533,1539 ----
      }
  
    /* Check the recorded loop exits.  */
!   FOR_EACH_LOOP (loop, 0)
      {
        if (!loop->exits || loop->exits->e != NULL)
  	{
*************** verify_loop_structure (void)
*** 1630,1636 ****
  	  err = 1;
  	}
  
!       FOR_EACH_LOOP (li, loop, 0)
  	{
  	  eloops = 0;
  	  for (exit = loop->exits->next; exit->e; exit = exit->next)
--- 1627,1633 ----
  	  err = 1;
  	}
  
!       FOR_EACH_LOOP (loop, 0)
  	{
  	  eloops = 0;
  	  for (exit = loop->exits->next; exit->e; exit = exit->next)
Index: gcc/cfgloopmanip.c
===================================================================
*** gcc/cfgloopmanip.c.orig	2013-11-19 10:19:51.000000000 +0100
--- gcc/cfgloopmanip.c	2013-11-19 13:38:35.292713058 +0100
*************** create_preheader (struct loop *loop, int
*** 1585,1597 ****
  void
  create_preheaders (int flags)
  {
-   loop_iterator li;
    struct loop *loop;
  
    if (!current_loops)
      return;
  
!   FOR_EACH_LOOP (li, loop, 0)
      create_preheader (loop, flags);
    loops_state_set (LOOPS_HAVE_PREHEADERS);
  }
--- 1585,1596 ----
  void
  create_preheaders (int flags)
  {
    struct loop *loop;
  
    if (!current_loops)
      return;
  
!   FOR_EACH_LOOP (loop, 0)
      create_preheader (loop, flags);
    loops_state_set (LOOPS_HAVE_PREHEADERS);
  }
*************** create_preheaders (int flags)
*** 1601,1611 ****
  void
  force_single_succ_latches (void)
  {
-   loop_iterator li;
    struct loop *loop;
    edge e;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        if (loop->latch != loop->header && single_succ_p (loop->latch))
  	continue;
--- 1600,1609 ----
  void
  force_single_succ_latches (void)
  {
    struct loop *loop;
    edge e;
  
!   FOR_EACH_LOOP (loop, 0)
      {
        if (loop->latch != loop->header && single_succ_p (loop->latch))
  	continue;
Index: gcc/config/mn10300/mn10300.c
===================================================================
*** gcc/config/mn10300/mn10300.c.orig	2013-03-18 12:31:42.000000000 +0100
--- gcc/config/mn10300/mn10300.c	2013-11-19 13:50:45.400192796 +0100
*************** mn10300_loop_contains_call_insn (loop_p
*** 3226,3232 ****
  static void
  mn10300_scan_for_setlb_lcc (void)
  {
-   loop_iterator liter;
    loop_p loop;
  
    DUMP ("Looking for loops that can use the SETLB insn", NULL_RTX);
--- 3226,3231 ----
*************** mn10300_scan_for_setlb_lcc (void)
*** 3241,3247 ****
       if an inner loop is not suitable for use with the SETLB/Lcc insns, it may
       be the case that its parent loop is suitable.  Thus we should check all
       loops, but work from the innermost outwards.  */
!   FOR_EACH_LOOP (liter, loop, LI_ONLY_INNERMOST)
      {
        const char * reason = NULL;
  
--- 3240,3246 ----
       if an inner loop is not suitable for use with the SETLB/Lcc insns, it may
       be the case that its parent loop is suitable.  Thus we should check all
       loops, but work from the innermost outwards.  */
!   FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
      {
        const char * reason = NULL;
  
Index: gcc/graphite-clast-to-gimple.c
===================================================================
*** gcc/graphite-clast-to-gimple.c.orig	2013-11-15 15:49:18.000000000 +0100
--- gcc/graphite-clast-to-gimple.c	2013-11-19 13:39:01.061012855 +0100
*************** gloog (scop_p scop, bb_pbb_htab_type bb_
*** 1718,1727 ****
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
        loop_p loop;
-       loop_iterator li;
        int num_no_dependency = 0;
  
!       FOR_EACH_LOOP (li, loop, 0)
  	if (loop->can_be_parallel)
  	  num_no_dependency++;
  
--- 1718,1726 ----
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
        loop_p loop;
        int num_no_dependency = 0;
  
!       FOR_EACH_LOOP (loop, 0)
  	if (loop->can_be_parallel)
  	  num_no_dependency++;
  
Index: gcc/graphite-scop-detection.c
===================================================================
*** gcc/graphite-scop-detection.c.orig	2013-11-18 16:26:58.000000000 +0100
--- gcc/graphite-scop-detection.c	2013-11-19 13:39:20.589239997 +0100
*************** canonicalize_loop_closed_ssa (loop_p loo
*** 1375,1388 ****
  static void
  canonicalize_loop_closed_ssa_form (void)
  {
-   loop_iterator li;
    loop_p loop;
  
  #ifdef ENABLE_CHECKING
    verify_loop_closed_ssa (true);
  #endif
  
!   FOR_EACH_LOOP (li, loop, 0)
      canonicalize_loop_closed_ssa (loop);
  
    rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
--- 1375,1387 ----
  static void
  canonicalize_loop_closed_ssa_form (void)
  {
    loop_p loop;
  
  #ifdef ENABLE_CHECKING
    verify_loop_closed_ssa (true);
  #endif
  
!   FOR_EACH_LOOP (loop, 0)
      canonicalize_loop_closed_ssa (loop);
  
    rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
Index: gcc/graphite-sese-to-poly.c
===================================================================
*** gcc/graphite-sese-to-poly.c.orig	2013-11-18 16:26:59.000000000 +0100
--- gcc/graphite-sese-to-poly.c	2013-11-19 13:39:46.845545395 +0100
*************** rewrite_commutative_reductions_out_of_ss
*** 3062,3073 ****
  static void
  rewrite_commutative_reductions_out_of_ssa (scop_p scop)
  {
-   loop_iterator li;
    loop_p loop;
    bool changed = false;
    sese region = SCOP_REGION (scop);
  
!   FOR_EACH_LOOP (li, loop, 0)
      if (loop_in_sese_p (loop, region))
        changed |= rewrite_commutative_reductions_out_of_ssa_loop (scop, loop);
  
--- 3062,3072 ----
  static void
  rewrite_commutative_reductions_out_of_ssa (scop_p scop)
  {
    loop_p loop;
    bool changed = false;
    sese region = SCOP_REGION (scop);
  
!   FOR_EACH_LOOP (loop, 0)
      if (loop_in_sese_p (loop, region))
        changed |= rewrite_commutative_reductions_out_of_ssa_loop (scop, loop);
  
*************** rewrite_commutative_reductions_out_of_ss
*** 3089,3100 ****
  static bool
  scop_ivs_can_be_represented (scop_p scop)
  {
-   loop_iterator li;
    loop_p loop;
    gimple_stmt_iterator psi;
    bool result = true;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        if (!loop_in_sese_p (loop, SCOP_REGION (scop)))
  	continue;
--- 3088,3098 ----
  static bool
  scop_ivs_can_be_represented (scop_p scop)
  {
    loop_p loop;
    gimple_stmt_iterator psi;
    bool result = true;
  
!   FOR_EACH_LOOP (loop, 0)
      {
        if (!loop_in_sese_p (loop, SCOP_REGION (scop)))
  	continue;
*************** scop_ivs_can_be_represented (scop_p scop
*** 3114,3120 ****
  	    }
  	}
        if (!result)
! 	FOR_EACH_LOOP_BREAK (li);
      }
  
    return result;
--- 3112,3118 ----
  	    }
  	}
        if (!result)
! 	break;
      }
  
    return result;
Index: gcc/ipa-inline-analysis.c
===================================================================
*** gcc/ipa-inline-analysis.c.orig	2013-11-19 11:14:46.000000000 +0100
--- gcc/ipa-inline-analysis.c	2013-11-19 13:40:09.262806076 +0100
*************** estimate_function_body_sizes (struct cgr
*** 2598,2611 ****
    if (!early && nonconstant_names.exists ())
      {
        struct loop *loop;
-       loop_iterator li;
        predicate loop_iterations = true_predicate ();
        predicate loop_stride = true_predicate ();
  
        if (dump_file && (dump_flags & TDF_DETAILS))
  	flow_loops_dump (dump_file, NULL, 0);
        scev_initialize ();
!       FOR_EACH_LOOP (li, loop, 0)
  	{
  	  vec<edge> exits;
  	  edge ex;
--- 2598,2610 ----
    if (!early && nonconstant_names.exists ())
      {
        struct loop *loop;
        predicate loop_iterations = true_predicate ();
        predicate loop_stride = true_predicate ();
  
        if (dump_file && (dump_flags & TDF_DETAILS))
  	flow_loops_dump (dump_file, NULL, 0);
        scev_initialize ();
!       FOR_EACH_LOOP (loop, 0)
  	{
  	  vec<edge> exits;
  	  edge ex;
Index: gcc/ipa-pure-const.c
===================================================================
*** gcc/ipa-pure-const.c.orig	2013-11-18 16:26:57.000000000 +0100
--- gcc/ipa-pure-const.c	2013-11-19 13:40:27.263015376 +0100
*************** end:
*** 789,805 ****
  	    }
  	  else
  	    {
- 	      loop_iterator li;
  	      struct loop *loop;
  	      scev_initialize ();
! 	      FOR_EACH_LOOP (li, loop, 0)
  		if (!finite_loop_p (loop))
  		  {
  		    if (dump_file)
  		      fprintf (dump_file, "    can not prove finiteness of "
  			       "loop %i\n", loop->num);
  		    l->looping =true;
! 		    FOR_EACH_LOOP_BREAK (li);
  		  }
  	      scev_finalize ();
  	    }
--- 789,804 ----
  	    }
  	  else
  	    {
  	      struct loop *loop;
  	      scev_initialize ();
! 	      FOR_EACH_LOOP (loop, 0)
  		if (!finite_loop_p (loop))
  		  {
  		    if (dump_file)
  		      fprintf (dump_file, "    can not prove finiteness of "
  			       "loop %i\n", loop->num);
  		    l->looping =true;
! 		    break;
  		  }
  	      scev_finalize ();
  	    }
Index: gcc/loop-init.c
===================================================================
*** gcc/loop-init.c.orig	2013-11-13 11:29:32.000000000 +0100
--- gcc/loop-init.c	2013-11-19 13:41:03.209433296 +0100
*************** loop_optimizer_init (unsigned flags)
*** 135,141 ****
  void
  loop_optimizer_finalize (void)
  {
-   loop_iterator li;
    struct loop *loop;
    basic_block bb;
  
--- 135,140 ----
*************** loop_optimizer_finalize (void)
*** 162,171 ****
  
    gcc_assert (current_loops != NULL);
  
!   FOR_EACH_LOOP (li, loop, 0)
!     {
!       free_simple_loop_desc (loop);
!     }
  
    /* Clean up.  */
    flow_loops_free (current_loops);
--- 161,168 ----
  
    gcc_assert (current_loops != NULL);
  
!   FOR_EACH_LOOP (loop, 0)
!     free_simple_loop_desc (loop);
  
    /* Clean up.  */
    flow_loops_free (current_loops);
*************** fix_loop_structure (bitmap changed_bbs)
*** 199,205 ****
  {
    basic_block bb;
    int record_exits = 0;
-   loop_iterator li;
    struct loop *loop;
    unsigned old_nloops, i;
  
--- 196,201 ----
*************** fix_loop_structure (bitmap changed_bbs)
*** 224,230 ****
       loops, so that when we remove the loops, we know that the loops inside
       are preserved, and do not waste time relinking loops that will be
       removed later.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        /* Detect the case that the loop is no longer present even though
           it wasn't marked for removal.
--- 220,226 ----
       loops, so that when we remove the loops, we know that the loops inside
       are preserved, and do not waste time relinking loops that will be
       removed later.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        /* Detect the case that the loop is no longer present even though
           it wasn't marked for removal.
Index: gcc/loop-invariant.c
===================================================================
*** gcc/loop-invariant.c.orig	2013-09-30 12:26:48.000000000 +0200
--- gcc/loop-invariant.c	2013-11-19 13:41:28.586728143 +0100
*************** calculate_loop_reg_pressure (void)
*** 1815,1823 ****
    basic_block bb;
    rtx insn, link;
    struct loop *loop, *parent;
-   loop_iterator li;
  
!   FOR_EACH_LOOP (li, loop, 0)
      if (loop->aux == NULL)
        {
  	loop->aux = xcalloc (1, sizeof (struct loop_data));
--- 1815,1822 ----
    basic_block bb;
    rtx insn, link;
    struct loop *loop, *parent;
  
!   FOR_EACH_LOOP (loop, 0)
      if (loop->aux == NULL)
        {
  	loop->aux = xcalloc (1, sizeof (struct loop_data));
*************** calculate_loop_reg_pressure (void)
*** 1884,1890 ****
    bitmap_clear (&curr_regs_live);
    if (flag_ira_region == IRA_REGION_MIXED
        || flag_ira_region == IRA_REGION_ALL)
!     FOR_EACH_LOOP (li, loop, 0)
        {
  	EXECUTE_IF_SET_IN_BITMAP (&LOOP_DATA (loop)->regs_live, 0, j, bi)
  	  if (! bitmap_bit_p (&LOOP_DATA (loop)->regs_ref, j))
--- 1883,1889 ----
    bitmap_clear (&curr_regs_live);
    if (flag_ira_region == IRA_REGION_MIXED
        || flag_ira_region == IRA_REGION_ALL)
!     FOR_EACH_LOOP (loop, 0)
        {
  	EXECUTE_IF_SET_IN_BITMAP (&LOOP_DATA (loop)->regs_live, 0, j, bi)
  	  if (! bitmap_bit_p (&LOOP_DATA (loop)->regs_ref, j))
*************** calculate_loop_reg_pressure (void)
*** 1898,1904 ****
        }
    if (dump_file == NULL)
      return;
!   FOR_EACH_LOOP (li, loop, 0)
      {
        parent = loop_outer (loop);
        fprintf (dump_file, "\n  Loop %d (parent %d, header bb%d, depth %d)\n",
--- 1897,1903 ----
        }
    if (dump_file == NULL)
      return;
!   FOR_EACH_LOOP (loop, 0)
      {
        parent = loop_outer (loop);
        fprintf (dump_file, "\n  Loop %d (parent %d, header bb%d, depth %d)\n",
*************** void
*** 1933,1939 ****
  move_loop_invariants (void)
  {
    struct loop *loop;
-   loop_iterator li;
  
    if (flag_ira_loop_pressure)
      {
--- 1932,1937 ----
*************** move_loop_invariants (void)
*** 1945,1951 ****
      }
    df_set_flags (DF_EQ_NOTES + DF_DEFER_INSN_RESCAN);
    /* Process the loops, innermost first.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        curr_loop = loop;
        /* move_single_loop_invariants for very large loops
--- 1943,1949 ----
      }
    df_set_flags (DF_EQ_NOTES + DF_DEFER_INSN_RESCAN);
    /* Process the loops, innermost first.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        curr_loop = loop;
        /* move_single_loop_invariants for very large loops
*************** move_loop_invariants (void)
*** 1954,1960 ****
  	move_single_loop_invariants (loop);
      }
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        free_loop_data (loop);
      }
--- 1952,1958 ----
  	move_single_loop_invariants (loop);
      }
  
!   FOR_EACH_LOOP (loop, 0)
      {
        free_loop_data (loop);
      }
Index: gcc/loop-unroll.c
===================================================================
*** gcc/loop-unroll.c.orig	2013-10-23 11:57:59.000000000 +0200
--- gcc/loop-unroll.c	2013-11-19 13:41:53.872022177 +0100
*************** unroll_and_peel_loops (int flags)
*** 269,275 ****
  {
    struct loop *loop;
    bool changed = false;
-   loop_iterator li;
  
    /* First perform complete loop peeling (it is almost surely a win,
       and affects parameters for further decision a lot).  */
--- 269,274 ----
*************** unroll_and_peel_loops (int flags)
*** 279,285 ****
    decide_unrolling_and_peeling (flags);
  
    /* Scan the loops, inner ones first.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        /* And perform the appropriate transformations.  */
        switch (loop->lpt_decision.decision)
--- 278,284 ----
    decide_unrolling_and_peeling (flags);
  
    /* Scan the loops, inner ones first.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        /* And perform the appropriate transformations.  */
        switch (loop->lpt_decision.decision)
*************** static void
*** 345,355 ****
  peel_loops_completely (int flags)
  {
    struct loop *loop;
-   loop_iterator li;
    bool changed = false;
  
    /* Scan the loops, the inner ones first.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        loop->lpt_decision.decision = LPT_NONE;
        location_t locus = get_loop_location (loop);
--- 344,353 ----
  peel_loops_completely (int flags)
  {
    struct loop *loop;
    bool changed = false;
  
    /* Scan the loops, the inner ones first.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        loop->lpt_decision.decision = LPT_NONE;
        location_t locus = get_loop_location (loop);
*************** static void
*** 386,395 ****
  decide_unrolling_and_peeling (int flags)
  {
    struct loop *loop;
-   loop_iterator li;
  
    /* Scan the loops, inner ones first.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        loop->lpt_decision.decision = LPT_NONE;
        location_t locus = get_loop_location (loop);
--- 384,392 ----
  decide_unrolling_and_peeling (int flags)
  {
    struct loop *loop;
  
    /* Scan the loops, inner ones first.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        loop->lpt_decision.decision = LPT_NONE;
        location_t locus = get_loop_location (loop);
Index: gcc/loop-unswitch.c
===================================================================
*** gcc/loop-unswitch.c.orig	2013-11-06 14:13:19.000000000 +0100
--- gcc/loop-unswitch.c	2013-11-19 13:42:06.743171722 +0100
*************** compare_and_jump_seq (rtx op0, rtx op1,
*** 138,150 ****
  void
  unswitch_loops (void)
  {
-   loop_iterator li;
    struct loop *loop;
    bool changed = false;
  
    /* Go through inner loops (only original ones).  */
  
!   FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
      changed |= unswitch_single_loop (loop, NULL_RTX, 0);
  
    iv_analysis_done ();
--- 138,149 ----
  void
  unswitch_loops (void)
  {
    struct loop *loop;
    bool changed = false;
  
    /* Go through inner loops (only original ones).  */
  
!   FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
      changed |= unswitch_single_loop (loop, NULL_RTX, 0);
  
    iv_analysis_done ();
Index: gcc/modulo-sched.c
===================================================================
*** gcc/modulo-sched.c.orig	2013-09-30 12:26:41.000000000 +0200
--- gcc/modulo-sched.c	2013-11-19 13:42:27.484412774 +0100
*************** sms_schedule (void)
*** 1351,1357 ****
    ddg_ptr *g_arr, g;
    int * node_order;
    int maxii, max_asap;
-   loop_iterator li;
    partial_schedule_ptr ps;
    basic_block bb = NULL;
    struct loop *loop;
--- 1351,1356 ----
*************** sms_schedule (void)
*** 1395,1401 ****
  
    /* Build DDGs for all the relevant loops and hold them in G_ARR
       indexed by the loop index.  */
!   FOR_EACH_LOOP (li, loop, 0)
      {
        rtx head, tail;
        rtx count_reg;
--- 1394,1400 ----
  
    /* Build DDGs for all the relevant loops and hold them in G_ARR
       indexed by the loop index.  */
!   FOR_EACH_LOOP (loop, 0)
      {
        rtx head, tail;
        rtx count_reg;
*************** sms_schedule (void)
*** 1406,1412 ****
            if (dump_file)
              fprintf (dump_file, "SMS reached max limit... \n");
  
! 	  FOR_EACH_LOOP_BREAK (li);
          }
  
        if (dump_file)
--- 1405,1411 ----
            if (dump_file)
              fprintf (dump_file, "SMS reached max limit... \n");
  
! 	  break;
          }
  
        if (dump_file)
*************** sms_schedule (void)
*** 1533,1539 ****
    }
  
    /* We don't want to perform SMS on new loops - created by versioning.  */
!   FOR_EACH_LOOP (li, loop, 0)
      {
        rtx head, tail;
        rtx count_reg, count_init;
--- 1532,1538 ----
    }
  
    /* We don't want to perform SMS on new loops - created by versioning.  */
!   FOR_EACH_LOOP (loop, 0)
      {
        rtx head, tail;
        rtx count_reg, count_init;
Index: gcc/predict.c
===================================================================
*** gcc/predict.c.orig	2013-11-18 16:26:57.000000000 +0100
--- gcc/predict.c	2013-11-19 13:42:51.728694399 +0100
*************** predict_extra_loop_exits (edge exit_edge
*** 1513,1524 ****
  static void
  predict_loops (void)
  {
-   loop_iterator li;
    struct loop *loop;
  
    /* Try to predict out blocks in a loop that are not part of a
       natural loop.  */
!   FOR_EACH_LOOP (li, loop, 0)
      {
        basic_block bb, *bbs;
        unsigned j, n_exits;
--- 1513,1523 ----
  static void
  predict_loops (void)
  {
    struct loop *loop;
  
    /* Try to predict out blocks in a loop that are not part of a
       natural loop.  */
!   FOR_EACH_LOOP (loop, 0)
      {
        basic_block bb, *bbs;
        unsigned j, n_exits;
Index: gcc/sel-sched-ir.c
===================================================================
*** gcc/sel-sched-ir.c.orig	2013-11-19 10:19:53.000000000 +0100
--- gcc/sel-sched-ir.c	2013-11-19 13:43:16.512982440 +0100
*************** make_regions_from_the_rest (void)
*** 6201,6211 ****
  /* Free data structures used in pipelining of loops.  */
  void sel_finish_pipelining (void)
  {
-   loop_iterator li;
    struct loop *loop;
  
    /* Release aux fields so we don't free them later by mistake.  */
!   FOR_EACH_LOOP (li, loop, 0)
      loop->aux = NULL;
  
    loop_optimizer_finalize ();
--- 6201,6210 ----
  /* Free data structures used in pipelining of loops.  */
  void sel_finish_pipelining (void)
  {
    struct loop *loop;
  
    /* Release aux fields so we don't free them later by mistake.  */
!   FOR_EACH_LOOP (loop, 0)
      loop->aux = NULL;
  
    loop_optimizer_finalize ();
*************** sel_find_rgns (void)
*** 6227,6237 ****
    if (current_loops)
      {
        loop_p loop;
-       loop_iterator li;
  
!       FOR_EACH_LOOP (li, loop, (flag_sel_sched_pipelining_outer_loops
! 				? LI_FROM_INNERMOST
! 				: LI_ONLY_INNERMOST))
  	make_regions_from_loop_nest (loop);
      }
  
--- 6226,6235 ----
    if (current_loops)
      {
        loop_p loop;
  
!       FOR_EACH_LOOP (loop, (flag_sel_sched_pipelining_outer_loops
! 			    ? LI_FROM_INNERMOST
! 			    : LI_ONLY_INNERMOST))
  	make_regions_from_loop_nest (loop);
      }
  
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c.orig	2013-11-19 10:19:53.000000000 +0100
--- gcc/tree-cfg.c	2013-11-19 13:43:41.386271363 +0100
*************** static void
*** 262,273 ****
  replace_loop_annotate ()
  {
    struct loop *loop;
-   loop_iterator li;
    basic_block bb;
    gimple_stmt_iterator gsi;
    gimple stmt;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        gsi = gsi_last_bb (loop->header);
        stmt = gsi_stmt (gsi);
--- 262,272 ----
  replace_loop_annotate ()
  {
    struct loop *loop;
    basic_block bb;
    gimple_stmt_iterator gsi;
    gimple stmt;
  
!   FOR_EACH_LOOP (loop, 0)
      {
        gsi = gsi_last_bb (loop->header);
        stmt = gsi_stmt (gsi);
*************** replace_uses_by (tree name, tree val)
*** 1639,1647 ****
    if (current_loops)
      {
        struct loop *loop;
-       loop_iterator li;
  
!       FOR_EACH_LOOP (li, loop, 0)
  	{
  	  substitute_in_loop_info (loop, name, val);
  	}
--- 1638,1645 ----
    if (current_loops)
      {
        struct loop *loop;
  
!       FOR_EACH_LOOP (loop, 0)
  	{
  	  substitute_in_loop_info (loop, name, val);
  	}
Index: gcc/tree-data-ref.c
===================================================================
*** gcc/tree-data-ref.c.orig	2013-11-18 16:26:58.000000000 +0100
--- gcc/tree-data-ref.c	2013-11-19 13:43:54.969429196 +0100
*************** analyze_all_data_dependences (struct loo
*** 4744,4753 ****
  void
  tree_check_data_deps (void)
  {
-   loop_iterator li;
    struct loop *loop_nest;
  
!   FOR_EACH_LOOP (li, loop_nest, 0)
      analyze_all_data_dependences (loop_nest);
  }
  
--- 4744,4752 ----
  void
  tree_check_data_deps (void)
  {
    struct loop *loop_nest;
  
!   FOR_EACH_LOOP (loop_nest, 0)
      analyze_all_data_dependences (loop_nest);
  }
  
Index: gcc/tree-if-conv.c
===================================================================
*** gcc/tree-if-conv.c.orig	2013-11-15 15:49:18.000000000 +0100
--- gcc/tree-if-conv.c	2013-11-19 13:44:07.344572925 +0100
*************** tree_if_conversion (struct loop *loop)
*** 1786,1792 ****
  static unsigned int
  main_tree_if_conversion (void)
  {
-   loop_iterator li;
    struct loop *loop;
    bool changed = false;
    unsigned todo = 0;
--- 1786,1791 ----
*************** main_tree_if_conversion (void)
*** 1794,1800 ****
    if (number_of_loops (cfun) <= 1)
      return 0;
  
!   FOR_EACH_LOOP (li, loop, 0)
      if (flag_tree_loop_if_convert == 1
  	|| flag_tree_loop_if_convert_stores == 1
  	|| flag_tree_loop_vectorize
--- 1793,1799 ----
    if (number_of_loops (cfun) <= 1)
      return 0;
  
!   FOR_EACH_LOOP (loop, 0)
      if (flag_tree_loop_if_convert == 1
  	|| flag_tree_loop_if_convert_stores == 1
  	|| flag_tree_loop_vectorize
Index: gcc/tree-loop-distribution.c
===================================================================
*** gcc/tree-loop-distribution.c.orig	2013-11-15 15:49:13.000000000 +0100
--- gcc/tree-loop-distribution.c	2013-11-19 13:44:19.728716745 +0100
*************** static unsigned int
*** 1659,1665 ****
  tree_loop_distribution (void)
  {
    struct loop *loop;
-   loop_iterator li;
    bool changed = false;
    basic_block bb;
    control_dependences *cd = NULL;
--- 1659,1664 ----
*************** tree_loop_distribution (void)
*** 1675,1681 ****
  
    /* We can at the moment only distribute non-nested loops, thus restrict
       walking to innermost loops.  */
!   FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
      {
        vec<gimple> work_list = vNULL;
        basic_block *bbs;
--- 1674,1680 ----
  
    /* We can at the moment only distribute non-nested loops, thus restrict
       walking to innermost loops.  */
!   FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
      {
        vec<gimple> work_list = vNULL;
        basic_block *bbs;
Index: gcc/tree-parloops.c
===================================================================
*** gcc/tree-parloops.c.orig	2013-11-18 09:58:51.000000000 +0100
--- gcc/tree-parloops.c	2013-11-19 13:44:34.473887944 +0100
*************** static void
*** 1744,1750 ****
  gen_parallel_loop (struct loop *loop, reduction_info_table_type reduction_list,
  		   unsigned n_threads, struct tree_niter_desc *niter)
  {
-   loop_iterator li;
    tree many_iterations_cond, type, nit;
    tree arg_struct, new_arg_struct;
    gimple_seq stmts;
--- 1744,1749 ----
*************** gen_parallel_loop (struct loop *loop, re
*** 1899,1905 ****
  
    /* Free loop bound estimations that could contain references to
       removed statements.  */
!   FOR_EACH_LOOP (li, loop, 0)
      free_numbers_of_iterations_estimates_loop (loop);
  
    /* Expand the parallel constructs.  We do it directly here instead of running
--- 1898,1904 ----
  
    /* Free loop bound estimations that could contain references to
       removed statements.  */
!   FOR_EACH_LOOP (loop, 0)
      free_numbers_of_iterations_estimates_loop (loop);
  
    /* Expand the parallel constructs.  We do it directly here instead of running
*************** parallelize_loops (void)
*** 2140,2146 ****
    bool changed = false;
    struct loop *loop;
    struct tree_niter_desc niter_desc;
-   loop_iterator li;
    reduction_info_table_type reduction_list;
    struct obstack parloop_obstack;
    HOST_WIDE_INT estimated;
--- 2139,2144 ----
*************** parallelize_loops (void)
*** 2156,2162 ****
    reduction_list.create (10);
    init_stmt_vec_info_vec ();
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        reduction_list.empty ();
        if (dump_file && (dump_flags & TDF_DETAILS))
--- 2154,2160 ----
    reduction_list.create (10);
    init_stmt_vec_info_vec ();
  
!   FOR_EACH_LOOP (loop, 0)
      {
        reduction_list.empty ();
        if (dump_file && (dump_flags & TDF_DETAILS))
Index: gcc/tree-predcom.c
===================================================================
*** gcc/tree-predcom.c.orig	2013-11-19 10:20:09.000000000 +0100
--- gcc/tree-predcom.c	2013-11-19 13:44:48.097046118 +0100
*************** tree_predictive_commoning (void)
*** 2509,2519 ****
  {
    bool unrolled = false;
    struct loop *loop;
-   loop_iterator li;
    unsigned ret = 0;
  
    initialize_original_copy_tables ();
!   FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
      if (optimize_loop_for_speed_p (loop))
        {
  	unrolled |= tree_predictive_commoning_loop (loop);
--- 2509,2518 ----
  {
    bool unrolled = false;
    struct loop *loop;
    unsigned ret = 0;
  
    initialize_original_copy_tables ();
!   FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
      if (optimize_loop_for_speed_p (loop))
        {
  	unrolled |= tree_predictive_commoning_loop (loop);
Index: gcc/tree-scalar-evolution.c
===================================================================
*** gcc/tree-scalar-evolution.c.orig	2013-11-15 15:49:14.000000000 +0100
--- gcc/tree-scalar-evolution.c	2013-11-19 13:45:08.297280755 +0100
*************** initialize_scalar_evolutions_analyzer (v
*** 3101,3116 ****
  void
  scev_initialize (void)
  {
-   loop_iterator li;
    struct loop *loop;
  
- 
    scalar_evolution_info = htab_create_ggc (100, hash_scev_info, eq_scev_info,
  					   del_scev_info);
  
    initialize_scalar_evolutions_analyzer ();
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        loop->nb_iterations = NULL_TREE;
      }
--- 3101,3114 ----
  void
  scev_initialize (void)
  {
    struct loop *loop;
  
    scalar_evolution_info = htab_create_ggc (100, hash_scev_info, eq_scev_info,
  					   del_scev_info);
  
    initialize_scalar_evolutions_analyzer ();
  
!   FOR_EACH_LOOP (loop, 0)
      {
        loop->nb_iterations = NULL_TREE;
      }
*************** scev_reset_htab (void)
*** 3142,3148 ****
  void
  scev_reset (void)
  {
-   loop_iterator li;
    struct loop *loop;
  
    scev_reset_htab ();
--- 3140,3145 ----
*************** scev_reset (void)
*** 3150,3156 ****
    if (!current_loops)
      return;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        loop->nb_iterations = NULL_TREE;
      }
--- 3147,3153 ----
    if (!current_loops)
      return;
  
!   FOR_EACH_LOOP (loop, 0)
      {
        loop->nb_iterations = NULL_TREE;
      }
*************** scev_const_prop (void)
*** 3296,3302 ****
    struct loop *loop, *ex_loop;
    bitmap ssa_names_to_remove = NULL;
    unsigned i;
-   loop_iterator li;
    gimple_stmt_iterator psi;
  
    if (number_of_loops (cfun) <= 1)
--- 3293,3298 ----
*************** scev_const_prop (void)
*** 3358,3364 ****
      }
  
    /* Now the regular final value replacement.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        edge exit;
        tree def, rslt, niter;
--- 3354,3360 ----
      }
  
    /* Now the regular final value replacement.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        edge exit;
        tree def, rslt, niter;
Index: gcc/tree-ssa-dce.c
===================================================================
*** gcc/tree-ssa-dce.c.orig	2013-11-15 15:49:18.000000000 +0100
--- gcc/tree-ssa-dce.c	2013-11-19 13:45:21.793437405 +0100
*************** find_obviously_necessary_stmts (bool agg
*** 393,399 ****
    /* Prevent the empty possibly infinite loops from being removed.  */
    if (aggressive)
      {
-       loop_iterator li;
        struct loop *loop;
        scev_initialize ();
        if (mark_irreducible_loops ())
--- 393,398 ----
*************** find_obviously_necessary_stmts (bool agg
*** 411,417 ****
  		}
  	  }
  
!       FOR_EACH_LOOP (li, loop, 0)
  	if (!finite_loop_p (loop))
  	  {
  	    if (dump_file)
--- 410,416 ----
  		}
  	  }
  
!       FOR_EACH_LOOP (loop, 0)
  	if (!finite_loop_p (loop))
  	  {
  	    if (dump_file)
Index: gcc/tree-ssa-loop-ch.c
===================================================================
*** gcc/tree-ssa-loop-ch.c.orig	2013-11-19 10:19:51.000000000 +0100
--- gcc/tree-ssa-loop-ch.c	2013-11-19 13:45:37.121615536 +0100
*************** do_while_loop_p (struct loop *loop)
*** 130,136 ****
  static unsigned int
  copy_loop_headers (void)
  {
-   loop_iterator li;
    struct loop *loop;
    basic_block header;
    edge exit, entry;
--- 130,135 ----
*************** copy_loop_headers (void)
*** 150,156 ****
    copied_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
    bbs_size = n_basic_blocks_for_fn (cfun);
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        /* Copy at most 20 insns.  */
        int limit = 20;
--- 149,155 ----
    copied_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
    bbs_size = n_basic_blocks_for_fn (cfun);
  
!   FOR_EACH_LOOP (loop, 0)
      {
        /* Copy at most 20 insns.  */
        int limit = 20;
Index: gcc/tree-ssa-loop-im.c
===================================================================
*** gcc/tree-ssa-loop-im.c.orig	2013-11-19 10:19:51.000000000 +0100
--- gcc/tree-ssa-loop-im.c	2013-11-19 13:45:50.626772271 +0100
*************** analyze_memory_references (void)
*** 1583,1596 ****
    gimple_stmt_iterator bsi;
    basic_block bb, *bbs;
    struct loop *loop, *outer;
-   loop_iterator li;
    unsigned i, n;
  
    /* Initialize bb_loop_postorder with a mapping from loop->num to
       its postorder index.  */
    i = 0;
    bb_loop_postorder = XNEWVEC (unsigned, number_of_loops (cfun));
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      bb_loop_postorder[loop->num] = i++;
    /* Collect all basic-blocks in loops and sort them after their
       loops postorder.  */
--- 1583,1595 ----
    gimple_stmt_iterator bsi;
    basic_block bb, *bbs;
    struct loop *loop, *outer;
    unsigned i, n;
  
    /* Initialize bb_loop_postorder with a mapping from loop->num to
       its postorder index.  */
    i = 0;
    bb_loop_postorder = XNEWVEC (unsigned, number_of_loops (cfun));
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      bb_loop_postorder[loop->num] = i++;
    /* Collect all basic-blocks in loops and sort them after their
       loops postorder.  */
*************** analyze_memory_references (void)
*** 1616,1622 ****
  
    /* Propagate the information about accessed memory references up
       the loop hierarchy.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        /* Finalize the overall touched references (including subloops).  */
        bitmap_ior_into (&memory_accesses.all_refs_stored_in_loop[loop->num],
--- 1615,1621 ----
  
    /* Propagate the information about accessed memory references up
       the loop hierarchy.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        /* Finalize the overall touched references (including subloops).  */
        bitmap_ior_into (&memory_accesses.all_refs_stored_in_loop[loop->num],
Index: gcc/tree-ssa-loop-ivcanon.c
===================================================================
*** gcc/tree-ssa-loop-ivcanon.c.orig	2013-11-18 16:26:57.000000000 +0100
--- gcc/tree-ssa-loop-ivcanon.c	2013-11-19 13:46:04.281930783 +0100
*************** canonicalize_loop_induction_variables (s
*** 982,988 ****
  unsigned int
  canonicalize_induction_variables (void)
  {
-   loop_iterator li;
    struct loop *loop;
    bool changed = false;
    bool irred_invalidated = false;
--- 982,987 ----
*************** canonicalize_induction_variables (void)
*** 991,997 ****
    free_numbers_of_iterations_estimates ();
    estimate_numbers_of_iterations ();
  
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        changed |= canonicalize_loop_induction_variables (loop,
  							true, UL_SINGLE_ITER,
--- 990,996 ----
    free_numbers_of_iterations_estimates ();
    estimate_numbers_of_iterations ();
  
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        changed |= canonicalize_loop_induction_variables (loop,
  							true, UL_SINGLE_ITER,
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
*** gcc/tree-ssa-loop-ivopts.c.orig	2013-11-18 16:26:57.000000000 +0100
--- gcc/tree-ssa-loop-ivopts.c	2013-11-19 13:46:16.012066976 +0100
*************** tree_ssa_iv_optimize (void)
*** 6832,6843 ****
  {
    struct loop *loop;
    struct ivopts_data data;
-   loop_iterator li;
  
    tree_ssa_iv_optimize_init (&data);
  
    /* Optimize the loops starting with the innermost ones.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
  	flow_loop_dump (loop, dump_file, NULL, 1);
--- 6832,6842 ----
  {
    struct loop *loop;
    struct ivopts_data data;
  
    tree_ssa_iv_optimize_init (&data);
  
    /* Optimize the loops starting with the innermost ones.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
  	flow_loop_dump (loop, dump_file, NULL, 1);
Index: gcc/tree-ssa-loop-manip.c
===================================================================
*** gcc/tree-ssa-loop-manip.c.orig	2013-11-19 10:19:51.000000000 +0100
--- gcc/tree-ssa-loop-manip.c	2013-11-19 13:46:26.714191137 +0100
*************** add_exit_phis (bitmap names_to_rename, b
*** 349,360 ****
  static void
  get_loops_exits (bitmap *loop_exits)
  {
-   loop_iterator li;
    struct loop *loop;
    unsigned j;
    edge e;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        vec<edge> exit_edges = get_loop_exit_edges (loop);
        loop_exits[loop->num] = BITMAP_ALLOC (&loop_renamer_obstack);
--- 349,359 ----
  static void
  get_loops_exits (bitmap *loop_exits)
  {
    struct loop *loop;
    unsigned j;
    edge e;
  
!   FOR_EACH_LOOP (loop, 0)
      {
        vec<edge> exit_edges = get_loop_exit_edges (loop);
        loop_exits[loop->num] = BITMAP_ALLOC (&loop_renamer_obstack);
Index: gcc/tree-ssa-loop-niter.c
===================================================================
*** gcc/tree-ssa-loop-niter.c.orig	2013-11-18 16:25:45.000000000 +0100
--- gcc/tree-ssa-loop-niter.c	2013-11-19 13:46:43.147381967 +0100
*************** estimated_stmt_executions (struct loop *
*** 3583,3596 ****
  void
  estimate_numbers_of_iterations (void)
  {
-   loop_iterator li;
    struct loop *loop;
  
    /* We don't want to issue signed overflow warnings while getting
       loop iteration estimates.  */
    fold_defer_overflow_warnings ();
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        estimate_numbers_of_iterations_loop (loop);
      }
--- 3583,3595 ----
  void
  estimate_numbers_of_iterations (void)
  {
    struct loop *loop;
  
    /* We don't want to issue signed overflow warnings while getting
       loop iteration estimates.  */
    fold_defer_overflow_warnings ();
  
!   FOR_EACH_LOOP (loop, 0)
      {
        estimate_numbers_of_iterations_loop (loop);
      }
*************** free_numbers_of_iterations_estimates_loo
*** 3860,3869 ****
  void
  free_numbers_of_iterations_estimates (void)
  {
-   loop_iterator li;
    struct loop *loop;
  
!   FOR_EACH_LOOP (li, loop, 0)
      {
        free_numbers_of_iterations_estimates_loop (loop);
      }
--- 3859,3867 ----
  void
  free_numbers_of_iterations_estimates (void)
  {
    struct loop *loop;
  
!   FOR_EACH_LOOP (loop, 0)
      {
        free_numbers_of_iterations_estimates_loop (loop);
      }
Index: gcc/tree-ssa-loop-prefetch.c
===================================================================
*** gcc/tree-ssa-loop-prefetch.c.orig	2013-11-18 16:26:59.000000000 +0100
--- gcc/tree-ssa-loop-prefetch.c	2013-11-19 13:46:55.282522842 +0100
*************** fail:
*** 1929,1935 ****
  unsigned int
  tree_ssa_prefetch_arrays (void)
  {
-   loop_iterator li;
    struct loop *loop;
    bool unrolled = false;
    int todo_flags = 0;
--- 1929,1934 ----
*************** tree_ssa_prefetch_arrays (void)
*** 1977,1983 ****
       here.  */
    gcc_assert ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) == 0);
  
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
  	fprintf (dump_file, "Processing loop %d:\n", loop->num);
--- 1976,1982 ----
       here.  */
    gcc_assert ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) == 0);
  
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
  	fprintf (dump_file, "Processing loop %d:\n", loop->num);
Index: gcc/tree-ssa-loop-unswitch.c
===================================================================
*** gcc/tree-ssa-loop-unswitch.c.orig	2013-11-15 15:49:13.000000000 +0100
--- gcc/tree-ssa-loop-unswitch.c	2013-11-19 13:47:05.026635917 +0100
*************** static tree tree_may_unswitch_on (basic_
*** 83,95 ****
  unsigned int
  tree_ssa_unswitch_loops (void)
  {
-   loop_iterator li;
    struct loop *loop;
    bool changed = false;
    HOST_WIDE_INT iterations;
  
    /* Go through inner loops (only original ones).  */
!   FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
          fprintf (dump_file, ";; Considering loop %d\n", loop->num);
--- 83,94 ----
  unsigned int
  tree_ssa_unswitch_loops (void)
  {
    struct loop *loop;
    bool changed = false;
    HOST_WIDE_INT iterations;
  
    /* Go through inner loops (only original ones).  */
!   FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
          fprintf (dump_file, ";; Considering loop %d\n", loop->num);
Index: gcc/tree-ssa-threadupdate.c
===================================================================
*** gcc/tree-ssa-threadupdate.c.orig	2013-11-19 10:19:51.000000000 +0100
--- gcc/tree-ssa-threadupdate.c	2013-11-19 13:49:39.068423369 +0100
*************** thread_through_all_blocks (bool may_peel
*** 1554,1560 ****
    bitmap_iterator bi;
    bitmap threaded_blocks;
    struct loop *loop;
-   loop_iterator li;
  
    /* We must know about loops in order to preserve them.  */
    gcc_assert (current_loops != NULL);
--- 1554,1559 ----
*************** thread_through_all_blocks (bool may_peel
*** 1582,1588 ****
    /* Then perform the threading through loop headers.  We start with the
       innermost loop, so that the changes in cfg we perform won't affect
       further threading.  */
!   FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
      {
        if (!loop->header
  	  || !bitmap_bit_p (threaded_blocks, loop->header->index))
--- 1581,1587 ----
    /* Then perform the threading through loop headers.  We start with the
       innermost loop, so that the changes in cfg we perform won't affect
       further threading.  */
!   FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
      {
        if (!loop->header
  	  || !bitmap_bit_p (threaded_blocks, loop->header->index))
Index: gcc/tree-vectorizer.c
===================================================================
*** gcc/tree-vectorizer.c.orig	2013-11-14 11:32:22.000000000 +0100
--- gcc/tree-vectorizer.c	2013-11-19 13:49:57.524637481 +0100
*************** vectorize_loops (void)
*** 323,329 ****
    unsigned int i;
    unsigned int num_vectorized_loops = 0;
    unsigned int vect_loops_num;
-   loop_iterator li;
    struct loop *loop;
    hash_table <simduid_to_vf> simduid_to_vf_htab;
    hash_table <simd_array_to_simduid> simd_array_to_simduid_htab;
--- 323,328 ----
*************** vectorize_loops (void)
*** 348,354 ****
    /* If some loop was duplicated, it gets bigger number
       than all previously defined loops.  This fact allows us to run
       only over initial loops skipping newly generated ones.  */
!   FOR_EACH_LOOP (li, loop, 0)
      if ((flag_tree_loop_vectorize && optimize_loop_nest_for_speed_p (loop))
  	|| loop->force_vect)
        {
--- 347,353 ----
    /* If some loop was duplicated, it gets bigger number
       than all previously defined loops.  This fact allows us to run
       only over initial loops skipping newly generated ones.  */
!   FOR_EACH_LOOP (loop, 0)
      if ((flag_tree_loop_vectorize && optimize_loop_nest_for_speed_p (loop))
  	|| loop->force_vect)
        {
Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c.orig	2013-11-18 16:25:44.000000000 +0100
--- gcc/tree-vrp.c	2013-11-19 13:50:09.783779672 +0100
*************** find_assert_locations (void)
*** 5892,5899 ****
       the order we compute liveness and insert asserts we otherwise
       fail to insert asserts into the loop latch.  */
    loop_p loop;
!   loop_iterator li;
!   FOR_EACH_LOOP (li, loop, 0)
      {
        i = loop->latch->index;
        unsigned int j = single_succ_edge (loop->latch)->dest_idx;
--- 5892,5898 ----
       the order we compute liveness and insert asserts we otherwise
       fail to insert asserts into the loop latch.  */
    loop_p loop;
!   FOR_EACH_LOOP (loop, 0)
      {
        i = loop->latch->index;
        unsigned int j = single_succ_edge (loop->latch)->dest_idx;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]