re PR tree-optimization/32160 (ICE with -O3 in verify_ssa)
authorZdenek Dvorak <dvorakz@suse.cz>
Thu, 31 May 2007 16:27:05 +0000 (18:27 +0200)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Thu, 31 May 2007 16:27:05 +0000 (16:27 +0000)
PR tree-optimization/32160
* tree-predcom.c (predcom_tmp_var): New function.  Mark created
variable as gimple reg.
(initialize_root_vars, initialize_root_vars_lm): Use predcom_tmp_var.

* gfortran.dg/predcom-1.f: New test.

From-SVN: r125228

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/predcom-1.f [new file with mode: 0644]
gcc/tree-predcom.c

index a0b2e7f4ec84cbc240d1de464005fc4798328699..64f97946581eef12890e6a90b25e6c783c6a98c6 100644 (file)
@@ -1,3 +1,10 @@
+2007-05-31  Zdenek Dvorak  <dvorakz@suse.cz>
+
+       PR tree-optimization/32160
+       * tree-predcom.c (predcom_tmp_var): New function.  Mark created
+       variable as gimple reg.
+       (initialize_root_vars, initialize_root_vars_lm): Use predcom_tmp_var.
+
 2007-05-31  Kazu Hirata  <kazu@codesourcery.com>
 
        * gcc.c (main): Don't consider linker options when issuing the
index e1e31c0b909b8f576f0de701baf0170e0002e837..86e6766ed6159eaa2d07cb7f6943696fdcb720eb 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-31  Zdenek Dvorak  <dvorakz@suse.cz>
+
+       PR tree-optimization/32160
+       * gfortran.dg/predcom-1.f: New test.
+
 2007-05-31  Richard Guenther  <rguenther@suse.de>
 
        * g++.dg/other/str_empty.C: Move...
diff --git a/gcc/testsuite/gfortran.dg/predcom-1.f b/gcc/testsuite/gfortran.dg/predcom-1.f
new file mode 100644 (file)
index 0000000..1cc0bf2
--- /dev/null
@@ -0,0 +1,16 @@
+! PR 32160, complex temporary variables were not marked as gimple registers
+! { dg-do compile }
+! { dg-options "-O3" }
+
+      REAL             FUNCTION CLANHT( N, E )
+      INTEGER            N
+      COMPLEX            E( * )
+      INTEGER            I
+      REAL               ANORM
+      INTRINSIC          ABS
+            DO 20 I = 1, N
+               ANORM = ANORM +ABS( E( I ) )+ ABS( E( I-1 ) )
+   20       CONTINUE
+      CLANHT = ANORM
+      RETURN
+      END
index a3a137f7d28541e1355f287b0d86920d3ccface7..b5c82923ee2371ac2a2a5c2711f3ee0b9a1aa42a 100644 (file)
@@ -1401,6 +1401,26 @@ mark_virtual_ops_for_renaming_list (tree list)
     mark_virtual_ops_for_renaming (tsi_stmt (tsi));
 }
 
+/* Returns a new temporary variable used for the I-th variable carrying
+   value of REF.  The variable's uid is marked in TMP_VARS.  */
+
+static tree
+predcom_tmp_var (tree ref, unsigned i, bitmap tmp_vars)
+{
+  tree type = TREE_TYPE (ref);
+  tree var = create_tmp_var (type, get_lsm_tmp_name (ref, i));
+
+  /* We never access the components of the temporary variable in predictive
+     commoning.  */
+  if (TREE_CODE (type) == COMPLEX_TYPE
+      || TREE_CODE (type) == VECTOR_TYPE)
+    DECL_GIMPLE_REG_P (var) = 1;
+
+  add_referenced_var (var);
+  bitmap_set_bit (tmp_vars, DECL_UID (var));
+  return var;
+}
+
 /* Creates the variables for CHAIN, as well as phi nodes for them and
    initialization on entry to LOOP.  Uids of the newly created
    temporary variables are marked in TMP_VARS.  */
@@ -1429,9 +1449,7 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
 
   for (i = 0; i < n + (reuse_first ? 0 : 1); i++)
     {
-      var = create_tmp_var (TREE_TYPE (ref), get_lsm_tmp_name (ref, i));
-      add_referenced_var (var);
-      bitmap_set_bit (tmp_vars, DECL_UID (var));
+      var = predcom_tmp_var (ref, i, tmp_vars);
       VEC_quick_push (tree, chain->vars, var);
     }
   if (reuse_first)
@@ -1499,9 +1517,7 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
   init = VEC_index (tree, inits, 0);
 
   *vars = VEC_alloc (tree, heap, written ? 2 : 1);
-  var = create_tmp_var (TREE_TYPE (ref), get_lsm_tmp_name (ref, 0));
-  add_referenced_var (var);
-  bitmap_set_bit (tmp_vars, DECL_UID (var));
+  var = predcom_tmp_var (ref, 0, tmp_vars);
   VEC_quick_push (tree, *vars, var);
   if (written)
     VEC_quick_push (tree, *vars, VEC_index (tree, *vars, 0));