]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
graphite-isl-ast-to-gimple.c (max_mode_int_precision, [...]): Avoid global constructo...
authorRichard Biener <rguenther@suse.de>
Fri, 13 Oct 2017 10:40:42 +0000 (10:40 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 13 Oct 2017 10:40:42 +0000 (10:40 +0000)
2017-10-13  Richard Biener  <rguenther@suse.de>

* graphite-isl-ast-to-gimple.c (max_mode_int_precision,
graphite_expression_type_precision): Avoid global constructor
by moving ...
(translate_isl_ast_to_gimple::translate_isl_ast_to_gimple): Here.
(translate_isl_ast_to_gimple::graphite_expr_type): Add type
member.
(translate_isl_ast_to_gimple::translate_isl_ast_node_for): Use it.
(translate_isl_ast_to_gimple::build_iv_mapping): Likewise.
(translate_isl_ast_to_gimple::graphite_create_new_guard): Likewise.
* graphite-sese-to-poly.c (build_original_schedule): Return nothing.

* gcc.dg/graphite/scop-10.c: Enlarge array to avoid undefined
behavior.
* gcc.dg/graphite/scop-7.c: Likewise.
* gcc.dg/graphite/scop-8.c: Likewise.

From-SVN: r253719

gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/graphite-sese-to-poly.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/scop-10.c
gcc/testsuite/gcc.dg/graphite/scop-7.c
gcc/testsuite/gcc.dg/graphite/scop-8.c

index 57686022742b1f0b8377ab5763e4caa6a11ad2e8..8f764889fb4700fbd2a27cab11837db9008058b4 100644 (file)
@@ -1,3 +1,16 @@
+2017-10-13  Richard Biener  <rguenther@suse.de>
+
+       * graphite-isl-ast-to-gimple.c (max_mode_int_precision,
+       graphite_expression_type_precision): Avoid global constructor
+       by moving ...
+       (translate_isl_ast_to_gimple::translate_isl_ast_to_gimple): Here.
+       (translate_isl_ast_to_gimple::graphite_expr_type): Add type
+       member.
+       (translate_isl_ast_to_gimple::translate_isl_ast_node_for): Use it.
+       (translate_isl_ast_to_gimple::build_iv_mapping): Likewise.
+       (translate_isl_ast_to_gimple::graphite_create_new_guard): Likewise.
+       * graphite-sese-to-poly.c (build_original_schedule): Return nothing.
+
 2017-10-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/82499
index 874941824cd98ed505de5930b5ebf16e46e0de46..b761fadef205bc18da2b58eaf9eb3ab04d6702b7 100644 (file)
@@ -58,15 +58,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa.h"
 #include "graphite.h"
 
-/* We always try to use signed 128 bit types, but fall back to smaller types
-   in case a platform does not provide types of these sizes. In the future we
-   should use isl to derive the optimal type for each subexpression.  */
-
-static int max_mode_int_precision =
-  GET_MODE_PRECISION (int_mode_for_size (MAX_FIXED_MODE_SIZE, 0).require ());
-static int graphite_expression_type_precision = 128 <= max_mode_int_precision ?
-                                               128 : max_mode_int_precision;
-
 struct ast_build_info
 {
   ast_build_info()
@@ -143,8 +134,7 @@ enum phi_node_kind
 class translate_isl_ast_to_gimple
 {
  public:
-  translate_isl_ast_to_gimple (sese_info_p r)
-    : region (r), codegen_error (false) { }
+  translate_isl_ast_to_gimple (sese_info_p r);
   edge translate_isl_ast (loop_p context_loop, __isl_keep isl_ast_node *node,
                          edge next_e, ivs_params &ip);
   edge translate_isl_ast_node_for (loop_p context_loop,
@@ -235,8 +225,24 @@ private:
 
   /* A vector of all the edges at if_condition merge points.  */
   auto_vec<edge, 2> merge_points;
+
+  tree graphite_expr_type;
 };
 
+translate_isl_ast_to_gimple::translate_isl_ast_to_gimple (sese_info_p r)
+  : region (r), codegen_error (false)
+{
+  /* We always try to use signed 128 bit types, but fall back to smaller types
+     in case a platform does not provide types of these sizes. In the future we
+     should use isl to derive the optimal type for each subexpression.  */
+  int max_mode_int_precision
+    = GET_MODE_PRECISION (int_mode_for_size (MAX_FIXED_MODE_SIZE, 0).require ());
+  int graphite_expr_type_precision
+    = 128 <= max_mode_int_precision ?  128 : max_mode_int_precision;
+  graphite_expr_type
+    = build_nonstandard_integer_type (graphite_expr_type_precision, 0);
+}
+
 /* Return the tree variable that corresponds to the given isl ast identifier
    expression (an isl_ast_expr of type isl_ast_expr_id).
 
@@ -702,8 +708,7 @@ translate_isl_ast_node_for (loop_p context_loop, __isl_keep isl_ast_node *node,
                            edge next_e, ivs_params &ip)
 {
   gcc_assert (isl_ast_node_get_type (node) == isl_ast_node_for);
-  tree type
-    = build_nonstandard_integer_type (graphite_expression_type_precision, 0);
+  tree type = graphite_expr_type;
 
   isl_ast_expr *for_init = isl_ast_node_for_get_init (node);
   tree lb = gcc_expression_from_isl_expression (type, for_init, ip);
@@ -742,8 +747,7 @@ build_iv_mapping (vec<tree> iv_map, gimple_poly_bb_p gbb,
   for (i = 1; i < isl_ast_expr_get_op_n_arg (user_expr); i++)
     {
       arg_expr = isl_ast_expr_get_op_arg (user_expr, i);
-      tree type =
-       build_nonstandard_integer_type (graphite_expression_type_precision, 0);
+      tree type = graphite_expr_type;
       tree t = gcc_expression_from_isl_expression (type, arg_expr, ip);
 
       /* To fail code generation, we generate wrong code until we discard it.  */
@@ -841,8 +845,7 @@ edge translate_isl_ast_to_gimple::
 graphite_create_new_guard (edge entry_edge, __isl_take isl_ast_expr *if_cond,
                           ivs_params &ip)
 {
-  tree type =
-    build_nonstandard_integer_type (graphite_expression_type_precision, 0);
+  tree type = graphite_expr_type;
   tree cond_expr = gcc_expression_from_isl_expression (type, if_cond, ip);
 
   /* To fail code generation, we generate wrong code until we discard it.  */
index ed6cbeccca1f6f5a97d3924313fe1da0e842a789..fc16ca969ebe3537b11154bb3f3a8f2a1da4da44 100644 (file)
@@ -1194,7 +1194,7 @@ build_schedule_loop_nest (scop_p scop, int *index, loop_p context_loop)
 
 /* Build the schedule of the SCOP.  */
 
-static bool
+static void
 build_original_schedule (scop_p scop)
 {
   int i = 0;
@@ -1216,9 +1216,6 @@ build_original_schedule (scop_p scop)
       fprintf (dump_file, "[sese-to-poly] original schedule:\n");
       print_isl_schedule (dump_file, scop->original_schedule);
     }
-  if (!scop->original_schedule)
-    return false;
-  return true;
 }
 
 /* Builds the polyhedral representation for a SESE region.  */
index 30ab9bd49e503c6a1960ebd79ae97b8a51eb7ff3..29dace4446286e8fb177b96df5ea1f1d53cd3f9d 100644 (file)
@@ -1,3 +1,10 @@
+2017-10-13  Richard Biener  <rguenther@suse.de>
+
+       * gcc.dg/graphite/scop-10.c: Enlarge array to avoid undefined
+       behavior.
+       * gcc.dg/graphite/scop-7.c: Likewise.
+       * gcc.dg/graphite/scop-8.c: Likewise.
+
 2017-10-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/82499
index 39ed5d7ea7b19c4ce9b2124b0f4271da25cc4aea..20d53510b4ec508ddeb3837b55b97379a9d7c52c 100644 (file)
@@ -4,7 +4,7 @@ int toto()
 {
   int i, j, k;
   int a[100][100];
-  int b[100];
+  int b[200];
 
   for (i = 1; i < 100; i++)
     {
index 3e337d0c6036058ea2c9525cf705afcedd09bc70..2f0a50470e912e7461531132ecf4bef22f8fbace 100644 (file)
@@ -4,7 +4,7 @@ int toto()
 {
   int i, j, k;
   int a[100][100];
-  int b[100];
+  int b[200];
 
   for (i = 1; i < 100; i++)
     {
index 71d5c531fb833d6e08db7bfd53bd1aecd76492e2..3ceb5d874d604679b9a7ce9e171e0d4a9aae23f8 100644 (file)
@@ -4,7 +4,7 @@ int toto()
 {
   int i, j, k;
   int a[100][100];
-  int b[100];
+  int b[200];
 
   for (i = 1; i < 100; i++)
     {