* [PATCH][GRAPHITE] Abstract away codegen_error setting
@ 2017-09-29 8:52 Richard Biener
2017-09-29 14:32 ` Sebastian Pop
0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2017-09-29 8:52 UTC (permalink / raw)
To: gcc-patches
This moves it to a function to make it easy to enable ICEin on them
in one place.
Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.
Richard.
2017-09-29 Richard Biener <rguenther@suse.de>
* graphite-isl-ast-to-gimple.c
(translate_isl_ast_to_gimple::set_codegen_error): New function.
(binary_op_to_tree): Use it.
(get_rename_from_scev): Likewise.
(copy_loop_phi_nodes): Likewise.
(copy_bb_and_scalar_dependences): Likewise.
(translate_pending_phi_nodes): Likewise.
Index: gcc/graphite-isl-ast-to-gimple.c
===================================================================
--- gcc/graphite-isl-ast-to-gimple.c (revision 253249)
+++ gcc/graphite-isl-ast-to-gimple.c (working copy)
@@ -240,6 +240,7 @@ class translate_isl_ast_to_gimple
void gsi_insert_earliest (gimple_seq seq);
tree rename_all_uses (tree new_expr, basic_block new_bb, basic_block old_bb);
bool codegen_error_p () const { return codegen_error; }
+ void set_codegen_error () { codegen_error = true; }
bool is_constant (tree op) const
{
return TREE_CODE (op) == INTEGER_CST
@@ -347,7 +348,7 @@ binary_op_to_tree (tree type, __isl_take
division by 2^64 that is folded to 0. */
if (integer_zerop (tree_rhs_expr))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL_TREE;
}
return fold_build2 (EXACT_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr);
@@ -357,7 +358,7 @@ binary_op_to_tree (tree type, __isl_take
division by 2^64 that is folded to 0. */
if (integer_zerop (tree_rhs_expr))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL_TREE;
}
return fold_build2 (TRUNC_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr);
@@ -368,7 +369,7 @@ binary_op_to_tree (tree type, __isl_take
division by 2^64 that is folded to 0. */
if (integer_zerop (tree_rhs_expr))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL_TREE;
}
return fold_build2 (TRUNC_MOD_EXPR, type, tree_lhs_expr, tree_rhs_expr);
@@ -378,7 +379,7 @@ binary_op_to_tree (tree type, __isl_take
division by 2^64 that is folded to 0. */
if (integer_zerop (tree_rhs_expr))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL_TREE;
}
return fold_build2 (FLOOR_DIV_EXPR, type, tree_lhs_expr, tree_rhs_expr);
@@ -1497,7 +1498,7 @@ get_rename_from_scev (tree old_name, gim
tree new_expr;
if (chrec_contains_undetermined (scev))
{
- codegen_error = true;
+ set_codegen_error ();
return build_zero_cst (TREE_TYPE (old_name));
}
@@ -1510,7 +1511,7 @@ get_rename_from_scev (tree old_name, gim
if (chrec_contains_undetermined (new_expr)
|| tree_contains_chrecs (new_expr, NULL))
{
- codegen_error = true;
+ set_codegen_error ();
return build_zero_cst (TREE_TYPE (old_name));
}
@@ -1519,7 +1520,7 @@ get_rename_from_scev (tree old_name, gim
basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (new_expr));
if (bb && !dominated_by_p (CDI_DOMINATORS, new_bb, bb))
{
- codegen_error = true;
+ set_codegen_error ();
return build_zero_cst (TREE_TYPE (old_name));
}
}
@@ -1539,7 +1540,7 @@ get_rename_from_scev (tree old_name, gim
basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (new_ssa_name));
if (bb && !dominated_by_p (CDI_DOMINATORS, new_bb, bb))
{
- codegen_error = true;
+ set_codegen_error ();
return build_zero_cst (TREE_TYPE (old_name));
}
}
@@ -1820,8 +1822,8 @@ copy_loop_phi_nodes (basic_block bb, bas
tree new_res = create_new_def_for (res, new_phi,
gimple_phi_result_ptr (new_phi));
set_rename (res, new_res);
- codegen_error = !copy_loop_phi_args (phi, ibp_old_bb, new_phi,
- ibp_new_bb, true);
+ if (!copy_loop_phi_args (phi, ibp_old_bb, new_phi, ibp_new_bb, true))
+ set_codegen_error ();
update_stmt (new_phi);
if (dump_file)
@@ -2593,7 +2595,7 @@ copy_bb_and_scalar_dependences (basic_bl
outside the region. */
if (num_phis)
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
}
@@ -2608,7 +2610,7 @@ copy_bb_and_scalar_dependences (basic_bl
edge e = edge_for_new_close_phis (bb);
if (!e)
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
@@ -2622,7 +2624,7 @@ copy_bb_and_scalar_dependences (basic_bl
if (!copy_loop_close_phi_nodes (bb, phi_bb, iv_map))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
@@ -2644,7 +2646,7 @@ copy_bb_and_scalar_dependences (basic_bl
code. See gfortran.dg/graphite/pr29832.f90. */
if (EDGE_COUNT (bb->preds) != EDGE_COUNT (phi_bb->preds))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
@@ -2664,7 +2666,7 @@ copy_bb_and_scalar_dependences (basic_bl
extend that to reductions that cannot be analyzed by SCEV. */
if (!bb_in_sese_p (phi_bb, region->if_region->true_region->region))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
@@ -2673,7 +2675,7 @@ copy_bb_and_scalar_dependences (basic_bl
bb->index);
if (!copy_loop_phi_nodes (bb, phi_bb))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
}
@@ -2695,7 +2697,7 @@ copy_bb_and_scalar_dependences (basic_bl
|| !bb_in_sese_p (phi_bb, region->if_region->true_region->region)
|| !copy_cond_phi_nodes (bb, phi_bb, iv_map))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
}
@@ -2718,7 +2720,7 @@ copy_bb_and_scalar_dependences (basic_bl
if (!graphite_copy_stmts_from_block (bb, new_bb, iv_map))
{
- codegen_error = true;
+ set_codegen_error ();
return NULL;
}
@@ -2752,12 +2754,18 @@ translate_pending_phi_nodes ()
auto_vec <tree, 1> iv_map;
if (bb_contains_loop_phi_nodes (new_bb)
&& bb_contains_loop_phi_nodes (old_bb))
- codegen_error = !copy_loop_phi_args (old_phi, ibp_old_bb, new_phi,
- ibp_new_bb, false);
+ {
+ if (!copy_loop_phi_args (old_phi, ibp_old_bb, new_phi,
+ ibp_new_bb, false))
+ set_codegen_error ();
+ }
else if (bb_contains_loop_close_phi_nodes (new_bb))
- codegen_error = !copy_loop_close_phi_args (old_bb, new_bb, iv_map, false);
- else
- codegen_error = !copy_cond_phi_args (old_phi, new_phi, iv_map, false);
+ {
+ if (!copy_loop_close_phi_args (old_bb, new_bb, iv_map, false))
+ set_codegen_error ();
+ }
+ else if (!copy_cond_phi_args (old_phi, new_phi, iv_map, false))
+ set_codegen_error ();
if (dump_file)
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][GRAPHITE] Abstract away codegen_error setting
2017-09-29 8:52 [PATCH][GRAPHITE] Abstract away codegen_error setting Richard Biener
@ 2017-09-29 14:32 ` Sebastian Pop
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Pop @ 2017-09-29 14:32 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches
On Fri, Sep 29, 2017 at 3:52 AM, Richard Biener <rguenther@suse.de> wrote:
>
> This moves it to a function to make it easy to enable ICEin on them
> in one place.
>
> Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.
>
> Richard.
>
> 2017-09-29 Richard Biener <rguenther@suse.de>
>
> * graphite-isl-ast-to-gimple.c
> (translate_isl_ast_to_gimple::set_codegen_error): New function.
> (binary_op_to_tree): Use it.
> (get_rename_from_scev): Likewise.
> (copy_loop_phi_nodes): Likewise.
> (copy_bb_and_scalar_dependences): Likewise.
> (translate_pending_phi_nodes): Likewise.
Looks good. Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-29 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 8:52 [PATCH][GRAPHITE] Abstract away codegen_error setting Richard Biener
2017-09-29 14:32 ` Sebastian Pop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).