Commit 1a8821c5 by Richard Biener Committed by Richard Biener

graphite-isl-ast-to-gimple.c (max_mode_int_precision, [...]): Avoid global…

graphite-isl-ast-to-gimple.c (max_mode_int_precision, [...]): Avoid global constructor by moving ...

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
parent 2ecf9ac7
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
......@@ -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. */
......
......@@ -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. */
......
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
......
......@@ -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++)
{
......
......@@ -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++)
{
......
......@@ -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++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment