]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/lcm.c
c++: Handle multiple aggregate overloads [PR95319].
[thirdparty/gcc.git] / gcc / lcm.c
index f6d1ed542f42427de875c1d106b3ba9d3e925735..fc4d564845dad2f2a59a6cf58c94edc3a559d330 100644 (file)
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -1,5 +1,5 @@
 /* Generic partial redundancy elimination with lazy code motion support.
-   Copyright (C) 1998-2015 Free Software Foundation, Inc.
+   Copyright (C) 1998-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -52,15 +52,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
-#include "rtl.h"
-#include "regs.h"
-#include "flags.h"
-#include "insn-config.h"
-#include "recog.h"
 #include "cfganal.h"
 #include "lcm.h"
-#include "tm_p.h"
-#include "dumpfile.h"
 
 /* Edge based LCM routines.  */
 static void compute_antinout_edge (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
@@ -177,15 +170,12 @@ compute_earliest (struct edge_list *edge_list, int n_exprs, sbitmap *antin,
                  sbitmap *antout, sbitmap *avout, sbitmap *kill,
                  sbitmap *earliest)
 {
-  sbitmap difference, temp_bitmap;
   int x, num_edges;
   basic_block pred, succ;
 
   num_edges = NUM_EDGES (edge_list);
 
-  difference = sbitmap_alloc (n_exprs);
-  temp_bitmap = sbitmap_alloc (n_exprs);
-
+  auto_sbitmap difference (n_exprs), temp_bitmap (n_exprs);
   for (x = 0; x < num_edges; x++)
     {
       pred = INDEX_EDGE_PRED_BB (edge_list, x);
@@ -206,9 +196,6 @@ compute_earliest (struct edge_list *edge_list, int n_exprs, sbitmap *antin,
            }
        }
     }
-
-  sbitmap_free (temp_bitmap);
-  sbitmap_free (difference);
 }
 
 /* later(p,s) is dependent on the calculation of laterin(p).
@@ -283,9 +270,9 @@ compute_laterin (struct edge_list *edge_list, sbitmap *earliest,
 
   /* Add all the blocks to the worklist.  This prevents an early exit from
      the loop given our optimistic initialization of LATER above.  */
-  int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
-  int postorder_num = inverted_post_order_compute (postorder);
-  for (int i = 0; i < postorder_num; ++i)
+  auto_vec<int, 20> postorder;
+  inverted_post_order_compute (&postorder);
+  for (unsigned int i = 0; i < postorder.length (); ++i)
     {
       bb = BASIC_BLOCK_FOR_FN (cfun, postorder[i]);
       if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
@@ -294,7 +281,6 @@ compute_laterin (struct edge_list *edge_list, sbitmap *earliest,
       *qin++ = bb;
       bb->aux = bb;
     }
-  free (postorder);
 
   /* Note that we do not use the last allocated element for our queue,
      as EXIT_BLOCK is never inserted into it. */
@@ -525,9 +511,9 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout,
   /* Put every block on the worklist; this is necessary because of the
      optimistic initialization of AVOUT above.  Use inverted postorder
      to make the dataflow problem require less iterations.  */
-  int *postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
-  int postorder_num = inverted_post_order_compute (postorder);
-  for (int i = 0; i < postorder_num; ++i)
+  auto_vec<int, 20> postorder;
+  inverted_post_order_compute (&postorder);
+  for (unsigned int i = 0; i < postorder.length (); ++i)
     {
       bb = BASIC_BLOCK_FOR_FN (cfun, postorder[i]);
       if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
@@ -536,7 +522,6 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout,
       *qin++ = bb;
       bb->aux = bb;
     }
-  free (postorder);
 
   qin = worklist;
   qend = &worklist[n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS];
@@ -601,15 +586,12 @@ compute_farthest (struct edge_list *edge_list, int n_exprs,
                  sbitmap *st_avout, sbitmap *st_avin, sbitmap *st_antin,
                  sbitmap *kill, sbitmap *farthest)
 {
-  sbitmap difference, temp_bitmap;
   int x, num_edges;
   basic_block pred, succ;
 
   num_edges = NUM_EDGES (edge_list);
 
-  difference = sbitmap_alloc (n_exprs);
-  temp_bitmap = sbitmap_alloc (n_exprs);
-
+  auto_sbitmap difference (n_exprs), temp_bitmap (n_exprs);
   for (x = 0; x < num_edges; x++)
     {
       pred = INDEX_EDGE_PRED_BB (edge_list, x);
@@ -630,9 +612,6 @@ compute_farthest (struct edge_list *edge_list, int n_exprs,
            }
        }
     }
-
-  sbitmap_free (temp_bitmap);
-  sbitmap_free (difference);
 }
 
 /* Compute nearer and nearerout vectors for edge based lcm.