re PR regression/40001 (r146817 broke libgloss build for SPU)
authorRichard Guenther <rguenther@suse.de>
Sat, 2 May 2009 17:49:32 +0000 (17:49 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sat, 2 May 2009 17:49:32 +0000 (17:49 +0000)
2009-05-02  Richard Guenther  <rguenther@suse.de>

PR middle-end/40001
* tree-ssa.c (execute_update_addresses_taken): Properly check
if we can mark a variable DECL_GIMPLE_REG_P.
* gimple.c (is_gimple_reg): Re-order check for DECL_GIMPLE_REG_P
back to the end of the function.
(is_gimple_reg_type): Remove complex type special casing.
* gimplify.c (gimplify_bind_expr): Do not set DECL_GIMPLE_REG_P
if not optimizing.

* gcc.target/spu/pr40001.c: New testcase.

From-SVN: r147064

gcc/ChangeLog
gcc/gimple.c
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/spu/pr40001.c [new file with mode: 0644]
gcc/tree-ssa.c

index 62b394a1a760cb41e8615c7562fcd087e9e0270c..d05e7cbda9765a42a0634f4fa890034c8dd59dda 100644 (file)
@@ -1,3 +1,14 @@
+2009-05-02  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/40001
+       * tree-ssa.c (execute_update_addresses_taken): Properly check
+       if we can mark a variable DECL_GIMPLE_REG_P.
+       * gimple.c (is_gimple_reg): Re-order check for DECL_GIMPLE_REG_P
+       back to the end of the function.
+       (is_gimple_reg_type): Remove complex type special casing.
+       * gimplify.c (gimplify_bind_expr): Do not set DECL_GIMPLE_REG_P
+       if not optimizing.
+
 2009-05-02  Ben Elliston  <bje@au.ibm.com>
 
        * doc/collect2.texi (Collect2): Document search path behaviour
index db7f872b5cc4cc262b7c71f2ef39d685e503c4bf..6ea1470df57881f64f5cc804b091321df46435cc 100644 (file)
@@ -2805,13 +2805,7 @@ is_gimple_id (tree t)
 bool
 is_gimple_reg_type (tree type)
 {
-  /* In addition to aggregate types, we also exclude complex types if not
-     optimizing because they can be subject to partial stores in GNU C by
-     means of the __real__ and __imag__ operators and we cannot promote
-     them to total stores (see gimplify_modify_expr_complex_part).  */
-  return !(AGGREGATE_TYPE_P (type)
-          || (TREE_CODE (type) == COMPLEX_TYPE && !optimize));
-
+  return !AGGREGATE_TYPE_P (type);
 }
 
 /* Return true if T is a non-aggregate register variable.  */
@@ -2825,12 +2819,6 @@ is_gimple_reg (tree t)
   if (!is_gimple_variable (t))
     return false;
 
-  /* Complex and vector values must have been put into SSA-like form.
-     That is, no assignments to the individual components.  */
-  if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
-      || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
-    return DECL_GIMPLE_REG_P (t);
-
   if (!is_gimple_reg_type (TREE_TYPE (t)))
     return false;
 
@@ -2857,6 +2845,12 @@ is_gimple_reg (tree t)
   if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
     return false;
 
+  /* Complex and vector values must have been put into SSA-like form.
+     That is, no assignments to the individual components.  */
+  if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+      || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+    return DECL_GIMPLE_REG_P (t);
+
   return true;
 }
 
index d886784895f0f36dbadb63ffaeb1dd93cef4fce9..24481d15c435a541e7afcd5f7ce8d084430e2b1b 100644 (file)
@@ -1218,9 +1218,14 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
 
       /* Preliminarily mark non-addressed complex variables as eligible
         for promotion to gimple registers.  We'll transform their uses
-        as we find them.  */
-      if ((TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
-          || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+        as we find them.
+        We exclude complex types if not optimizing because they can be
+        subject to partial stores in GNU C by means of the __real__ and
+        __imag__ operators and we cannot promote them to total stores
+        (see gimplify_modify_expr_complex_part).  */
+      if (optimize
+         && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+             || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
          && !TREE_THIS_VOLATILE (t)
          && (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t))
          && !needs_to_live_in_memory (t))
index 69a3e67dbbeae387c22a3b5e1e72f614ba78e9d2..5fce794638f7b6ae3b88851b7e0cb4b076c0fb3a 100644 (file)
@@ -1,3 +1,8 @@
+2009-05-02  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/40001
+       * gcc.target/spu/pr40001.c: New testcase.
+
 2009-04-30  Adam Nemet  <anemet@caviumnetworks.com>
 
        * gcc.dg/ssp-1.c (__stack_chk_fail): Remove static.
diff --git a/gcc/testsuite/gcc.target/spu/pr40001.c b/gcc/testsuite/gcc.target/spu/pr40001.c
new file mode 100644 (file)
index 0000000..442f72d
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+void *
+sbrk (unsigned int increment)
+{
+  volatile register
+      __attribute__ ((__spu_vector__)) unsigned int sp_r1 __asm__ ("1");
+  unsigned int sps;
+
+  sps = __builtin_spu_extract (sp_r1, 0);
+  if (sps - 4096 >= increment)
+    return 0;
+  else
+    return ((void *) -1);
+}
+
index ddf52022b54828935710ed2633ba8bd10194e608..edbae39cd0ec62b3189b160eaeb5e52c8d072b00 100644 (file)
@@ -1573,7 +1573,9 @@ execute_update_addresses_taken (bool do_optimize)
        if (!DECL_GIMPLE_REG_P (var)
            && !bitmap_bit_p (not_reg_needs, DECL_UID (var))
            && (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
-               || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE))
+               || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
+           && !TREE_THIS_VOLATILE (var)
+           && (TREE_CODE (var) != VAR_DECL || !DECL_HARD_REGISTER (var)))
          {
            DECL_GIMPLE_REG_P (var) = 1;
            mark_sym_for_renaming (var);