gimple.h (gimple_store_p): New predicate.
authorRichard Biener <rguenther@suse.de>
Tue, 30 Oct 2012 14:14:04 +0000 (14:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 30 Oct 2012 14:14:04 +0000 (14:14 +0000)
2012-10-30  Richard Biener  <rguenther@suse.de>

* gimple.h (gimple_store_p): New predicate.
(gimple_assign_load_p): Likewise.
* tree-inline.c (estimate_num_insns): Use it.

* gcc.dg/vect/slp-perm-2.c: Adjust.

From-SVN: r192987

gcc/ChangeLog
gcc/gimple.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/slp-perm-2.c
gcc/tree-inline.c

index 8cf846bbd62a9cfeb5f7d93c1c891955ec9a568c..b1eabfc9488cd471d5636801a7dc98c777dbad4e 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-30  Richard Biener  <rguenther@suse.de>
+
+       * gimple.h (gimple_store_p): New predicate.
+       (gimple_assign_load_p): Likewise.
+       * tree-inline.c (estimate_num_insns): Use it.
+
 2012-10-30  Marc Glisse  <marc.glisse@inria.fr>
 
        * fold-const.c (fold_binary_op_with_conditional_arg): Handle vectors.
index b34016aaac139bac5064ffbddf63ab1960a2fe3c..19d45d00e3e2d87ceecb19ed43c1240f408a4d50 100644 (file)
@@ -2041,6 +2041,31 @@ gimple_assign_single_p (gimple gs)
           && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
 }
 
+/* Return true if GS performs a store to its lhs.  */
+
+static inline bool
+gimple_store_p (gimple gs)
+{
+  tree lhs = gimple_get_lhs (gs);
+  return lhs && !is_gimple_reg (lhs);
+}
+
+/* Return true if GS is an assignment that loads from its rhs1.  */
+
+static inline bool
+gimple_assign_load_p (gimple gs)
+{
+  tree rhs;
+  if (!gimple_assign_single_p (gs))
+    return false;
+  rhs = gimple_assign_rhs1 (gs);
+  if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
+    return true;
+  rhs = get_base_address (rhs);
+  return (DECL_P (rhs)
+         || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
+}
+
 
 /* Return true if S is a type-cast assignment.  */
 
index 87520a3dd405eb5f18418d0e4af190d00bb7ffcf..6573b8d76559c18688753eb8a2fabc4f40b66729 100644 (file)
@@ -1,3 +1,7 @@
+2012-10-30  Richard Biener  <rguenther@suse.de>
+
+       * gcc.dg/vect/slp-perm-2.c: Adjust.
+
 2012-10-30  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/55111
index 1bc95e2e98bfdbea6fc2f1f4448aa5c9716de574..27156f4829ebf4450001db856d6f3c0aad061faa 100644 (file)
@@ -12,7 +12,8 @@
 
 #define N 16
 
-void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput)
+void __attribute__((noinline))
+foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput)
 {
   unsigned int i, a, b;
 
index 2c8071e8c99d6766703b4985a4558eb45c85a350..69a664dbfcc8644b76ba995a57da1976018490e0 100644 (file)
@@ -3512,12 +3512,12 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
       lhs = gimple_assign_lhs (stmt);
       rhs = gimple_assign_rhs1 (stmt);
 
-      if (is_gimple_reg (lhs))
-       cost = 0;
-      else
-       cost = estimate_move_cost (TREE_TYPE (lhs));
+      cost = 0;
 
-      if (!is_gimple_reg (rhs) && !is_gimple_min_invariant (rhs))
+      /* Account for the cost of moving to / from memory.  */
+      if (gimple_store_p (stmt))
+       cost += estimate_move_cost (TREE_TYPE (lhs));
+      if (gimple_assign_load_p (stmt))
        cost += estimate_move_cost (TREE_TYPE (rhs));
 
       cost += estimate_operator_cost (gimple_assign_rhs_code (stmt), weights,