OSDN Git Service

PR tree-optimization/22228
authordorit <dorit@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Aug 2005 16:07:54 +0000 (16:07 +0000)
committerdorit <dorit@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 18 Aug 2005 16:07:54 +0000 (16:07 +0000)
        * tree-ssa-loop (pass_vectorize): Add TODO_verify_loops to todo_flags_start.
        * tree-vect-transform.c (vect_transform_loop): Mark the variables that
        are recorded in vect_vnames_to_rename for renaming.
        * tree-vectorizer.c (vect_vnames_to_rename): New global bitmap.
        (slpeel_update_phi_nodes_for_guard1): Record virtual vars for renaming
        in vect_vnames_to_rename.
        (vectorize_loops): Allocate and free the vect_vnames_to_rename bitmap.
        * tree-vectorizer.h (vect_vnames_to_rename): New extern variable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103252 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/vect/pr22543.cc [new file with mode: 0644]
gcc/tree-ssa-loop.c
gcc/tree-vect-transform.c
gcc/tree-vectorizer.c
gcc/tree-vectorizer.h

index fcc7fba..b83091c 100644 (file)
@@ -1,3 +1,15 @@
+2005-08-18  Dorit Nuzman  <dorit@il.ibm.com>
+
+       PR tree-optimization/22228
+       * tree-ssa-loop (pass_vectorize): Add TODO_verify_loops to todo_flags_start.
+       * tree-vect-transform.c (vect_transform_loop): Mark the variables that
+       are recorded in vect_vnames_to_rename for renaming.
+       * tree-vectorizer.c (vect_vnames_to_rename): New global bitmap.
+       (slpeel_update_phi_nodes_for_guard1): Record virtual vars for renaming
+       in vect_vnames_to_rename.
+       (vectorize_loops): Allocate and free the vect_vnames_to_rename bitmap.
+       * tree-vectorizer.h (vect_vnames_to_rename): New extern variable.
+
 2005-08-18  Jan Hubicka  <jh@suse.cz>
 
        PR c++/22034
index e631fef..1f0c092 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-18  Dorit Nuzman  <dorit@il.ibm.com>
+
+       PR tree-optimization/22228
+       * g++.dg/vect/pr22543.cc: New test.
+
 2005-08-17  Steven Bosscher  <stevenb@suse.de>
 
        PR tree-optimization/21574
diff --git a/gcc/testsuite/g++.dg/vect/pr22543.cc b/gcc/testsuite/g++.dg/vect/pr22543.cc
new file mode 100644 (file)
index 0000000..f5e55f1
--- /dev/null
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+
+struct A
+{
+  int i, j;
+
+  A() : i(), j() {}
+  ~A() {}
+
+  operator int() { return 0; }
+};
+
+struct B
+{
+  A foo() const { return A(); }
+};
+
+struct X { ~X(); };
+
+struct C
+{
+  C();
+
+  int z[4];
+};
+
+C::C()
+{
+  for (int i=0; i<4; ++i)
+    z[i]=0;
+
+  X x;
+
+  for (int i=0; i<4; ++i)
+    int j = B().foo();
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index abfcf15..05df8d1 100644 (file)
@@ -212,7 +212,7 @@ struct tree_opt_pass pass_vectorize =
   PROP_cfg | PROP_ssa,                  /* properties_required */
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
-  0,                                    /* todo_flags_start */
+  TODO_verify_loops,                   /* todo_flags_start */
   TODO_dump_func | TODO_update_ssa,    /* todo_flags_finish */
   0                                    /* letter */
 };
index 1923cbc..be5b779 100644 (file)
@@ -2735,10 +2735,16 @@ vect_transform_loop (loop_vec_info loop_vinfo,
   int i;
   tree ratio = NULL;
   int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+  bitmap_iterator bi;
+  unsigned int j;
 
   if (vect_print_dump_info (REPORT_DETAILS))
     fprintf (vect_dump, "=== vec_transform_loop ===");
 
+  /* CHECKME: we wouldn't need this if we calles update_ssa once
+     for all loops.  */
+  bitmap_zero (vect_vnames_to_rename);
+
   /* Peel the loop if there are data refs with unknown alignment.
      Only one data ref with unknown store is allowed.  */
 
@@ -2824,6 +2830,9 @@ vect_transform_loop (loop_vec_info loop_vinfo,
 
   slpeel_make_loop_iterate_ntimes (loop, ratio);
 
+  EXECUTE_IF_SET_IN_BITMAP (vect_vnames_to_rename, 0, j, bi)
+    mark_sym_for_renaming (SSA_NAME_VAR (ssa_name (j)));
+
   /* The memory tags and pointers in vectorized statements need to
      have their SSA forms updated.  FIXME, why can't this be delayed
      until all the loops have been transformed?  */
index 4bdb552..1cce052 100644 (file)
@@ -179,6 +179,9 @@ unsigned int vect_loops_num;
 
 /* Loop location.  */
 static LOC vect_loop_location;
+
+/* Bitmap of virtual variables to be renamed.  */
+bitmap vect_vnames_to_rename;
 \f
 /*************************************************************************
   Simple Loop Peeling Utilities
@@ -511,6 +514,7 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
   basic_block orig_bb = loop->header;
   edge new_exit_e;
   tree current_new_name;
+  tree name;
 
   /* Create new bb between loop and new_merge_bb.  */
   *new_exit_bb = split_edge (loop->single_exit);
@@ -522,6 +526,15 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
        orig_phi && update_phi;
        orig_phi = PHI_CHAIN (orig_phi), update_phi = PHI_CHAIN (update_phi))
     {
+      /* Virtual phi; Mark it for renaming. We actually want to call
+        mar_sym_for_renaming, but since all ssa renaming datastructures
+        are going to be freed before we get to call ssa_upate, we just
+        record this name for now in a bitmap, and will mark it for
+        renaming later.  */
+      name = PHI_RESULT (orig_phi);
+      if (!is_gimple_reg (SSA_NAME_VAR (name)))
+        bitmap_set_bit (vect_vnames_to_rename, SSA_NAME_VERSION (name));
+
       /** 1. Handle new-merge-point phis  **/
 
       /* 1.1. Generate new phi node in NEW_MERGE_BB:  */
@@ -2010,6 +2023,10 @@ vectorize_loops (struct loops *loops)
   /* Fix the verbosity level if not defined explicitly by the user.  */
   vect_set_dump_settings ();
 
+  /* Allocate the bitmap that records which virtual variables that 
+     need to be renamed.  */
+  vect_vnames_to_rename = BITMAP_ALLOC (NULL);
+
   /*  ----------- Analyze loops. -----------  */
 
   /* If some loop was duplicated, it gets bigger number 
@@ -2041,6 +2058,8 @@ vectorize_loops (struct loops *loops)
 
   /*  ----------- Finalize. -----------  */
 
+  BITMAP_FREE (vect_vnames_to_rename);
+
   for (i = 1; i < vect_loops_num; i++)
     {
       struct loop *loop = loops->parray[i];
index 5fdca3d..be42b96 100644 (file)
@@ -263,6 +263,9 @@ extern enum verbosity_levels vect_verbosity_level;
 /* Number of loops, at the beginning of vectorization.  */
 extern unsigned int vect_loops_num;
 
+/* Bitmap of virtual variables to be renamed.  */
+extern bitmap vect_vnames_to_rename;
+
 /*-----------------------------------------------------------------*/
 /* Function prototypes.                                            */
 /*-----------------------------------------------------------------*/