Commit a3201927 by Alexandre Oliva Committed by Alexandre Oliva

re PR debug/41888 (ICE from '-O -ftree-loop-distribution -fgraphite-identity -g')

PR debug/41888
PR debug/41886
* graphite-scop-detection.c (stmt_simple_for_scop_p): Debug stmts
are ok.
* graphite-sese-to-poly.c (graphite_stmt_p): Likewise.
(try_generate_gimple_bb): Skip debug stmts when finding data refs.
* sese.c (sese_build_liveouts_bb): Skip debug stmts.
(sese_bad_liveouts_use): New.
(sese_reset_debug_liveouts_bb): New.
(sese_build_liveouts): Use it.
(rename_variables_in_stmt): Reset debug stmts rather than creating
new vars for them.
(expand_scalar_variable_stmt): Likewise.

From-SVN: r154279
parent d785e46f
2009-11-18 Alexandre Oliva <aoliva@redhat.com> 2009-11-18 Alexandre Oliva <aoliva@redhat.com>
PR debug/41888
PR debug/41886
* graphite-scop-detection.c (stmt_simple_for_scop_p): Debug stmts
are ok.
* graphite-sese-to-poly.c (graphite_stmt_p): Likewise.
(try_generate_gimple_bb): Skip debug stmts when finding data refs.
* sese.c (sese_build_liveouts_bb): Skip debug stmts.
(sese_bad_liveouts_use): New.
(sese_reset_debug_liveouts_bb): New.
(sese_build_liveouts): Use it.
(rename_variables_in_stmt): Reset debug stmts rather than creating
new vars for them.
(expand_scalar_variable_stmt): Likewise.
2009-11-18 Alexandre Oliva <aoliva@redhat.com>
* df-scan.c (df_ref_create): Don't mark BB as dirty on debug insns. * df-scan.c (df_ref_create): Don't mark BB as dirty on debug insns.
(df_ref_remove): Likewise. (df_ref_remove): Likewise.
...@@ -372,6 +372,9 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop, ...@@ -372,6 +372,9 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop,
|| (gimple_code (stmt) == GIMPLE_ASM)) || (gimple_code (stmt) == GIMPLE_ASM))
return false; return false;
if (is_gimple_debug (stmt))
return true;
if (!stmt_has_simple_data_refs_p (outermost_loop, stmt)) if (!stmt_has_simple_data_refs_p (outermost_loop, stmt))
return false; return false;
......
...@@ -232,6 +232,7 @@ graphite_stmt_p (sese region, basic_block bb, ...@@ -232,6 +232,7 @@ graphite_stmt_p (sese region, basic_block bb,
switch (gimple_code (stmt)) switch (gimple_code (stmt))
{ {
case GIMPLE_DEBUG:
/* Control flow expressions can be ignored, as they are /* Control flow expressions can be ignored, as they are
represented in the iteration domains and will be represented in the iteration domains and will be
regenerated by graphite. */ regenerated by graphite. */
...@@ -338,7 +339,11 @@ try_generate_gimple_bb (scop_p scop, basic_block bb) ...@@ -338,7 +339,11 @@ try_generate_gimple_bb (scop_p scop, basic_block bb)
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
graphite_find_data_references_in_stmt (nest, gsi_stmt (gsi), &drs); {
gimple stmt = gsi_stmt (gsi);
if (!is_gimple_debug (stmt))
graphite_find_data_references_in_stmt (nest, stmt, &drs);
}
if (!graphite_stmt_p (SCOP_REGION (scop), bb, drs)) if (!graphite_stmt_p (SCOP_REGION (scop), bb, drs))
free_data_refs (drs); free_data_refs (drs);
......
...@@ -235,8 +235,73 @@ sese_build_liveouts_bb (sese region, bitmap liveouts, basic_block bb) ...@@ -235,8 +235,73 @@ sese_build_liveouts_bb (sese region, bitmap liveouts, basic_block bb)
PHI_ARG_DEF_FROM_EDGE (gsi_stmt (bsi), e)); PHI_ARG_DEF_FROM_EDGE (gsi_stmt (bsi), e));
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
FOR_EACH_SSA_USE_OPERAND (use_p, gsi_stmt (bsi), iter, SSA_OP_ALL_USES) {
sese_build_liveouts_use (region, liveouts, bb, USE_FROM_PTR (use_p)); gimple stmt = gsi_stmt (bsi);
if (is_gimple_debug (stmt))
continue;
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
sese_build_liveouts_use (region, liveouts, bb, USE_FROM_PTR (use_p));
}
}
/* For a USE in BB, return true if BB is outside REGION and it's not
in the LIVEOUTS set. */
static bool
sese_bad_liveouts_use (sese region, bitmap liveouts, basic_block bb,
tree use)
{
unsigned ver;
basic_block def_bb;
if (TREE_CODE (use) != SSA_NAME)
return false;
ver = SSA_NAME_VERSION (use);
/* If it's in liveouts, the variable will get a new PHI node, and
the debug use will be properly adjusted. */
if (bitmap_bit_p (liveouts, ver))
return false;
def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
if (!def_bb
|| !bb_in_sese_p (def_bb, region)
|| bb_in_sese_p (bb, region))
return false;
return true;
}
/* Reset debug stmts that reference SSA_NAMES defined in REGION that
are not marked as liveouts. */
static void
sese_reset_debug_liveouts_bb (sese region, bitmap liveouts, basic_block bb)
{
gimple_stmt_iterator bsi;
ssa_op_iter iter;
use_operand_p use_p;
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
if (!is_gimple_debug (stmt))
continue;
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
if (sese_bad_liveouts_use (region, liveouts, bb,
USE_FROM_PTR (use_p)))
{
gimple_debug_bind_reset_value (stmt);
update_stmt (stmt);
break;
}
}
} }
/* Build the LIVEOUTS of REGION: the set of variables defined inside /* Build the LIVEOUTS of REGION: the set of variables defined inside
...@@ -249,6 +314,9 @@ sese_build_liveouts (sese region, bitmap liveouts) ...@@ -249,6 +314,9 @@ sese_build_liveouts (sese region, bitmap liveouts)
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
sese_build_liveouts_bb (region, liveouts, bb); sese_build_liveouts_bb (region, liveouts, bb);
if (MAY_HAVE_DEBUG_INSNS)
FOR_EACH_BB (bb)
sese_reset_debug_liveouts_bb (region, liveouts, bb);
} }
/* Builds a new SESE region from edges ENTRY and EXIT. */ /* Builds a new SESE region from edges ENTRY and EXIT. */
...@@ -534,7 +602,19 @@ rename_variables_in_stmt (gimple stmt, htab_t map, gimple_stmt_iterator *insert_ ...@@ -534,7 +602,19 @@ rename_variables_in_stmt (gimple stmt, htab_t map, gimple_stmt_iterator *insert_
|| (TREE_CODE (expr) != SSA_NAME || (TREE_CODE (expr) != SSA_NAME
&& is_gimple_reg (use))) && is_gimple_reg (use)))
{ {
tree var = create_tmp_var (type_use, "var"); tree var;
if (is_gimple_debug (stmt))
{
if (gimple_debug_bind_p (stmt))
gimple_debug_bind_reset_value (stmt);
else
gcc_unreachable ();
break;
}
var = create_tmp_var (type_use, "var");
if (type_use != type_expr) if (type_use != type_expr)
expr = fold_convert (type_use, expr); expr = fold_convert (type_use, expr);
...@@ -827,6 +907,16 @@ expand_scalar_variables_stmt (gimple stmt, basic_block bb, sese region, ...@@ -827,6 +907,16 @@ expand_scalar_variables_stmt (gimple stmt, basic_block bb, sese region,
if (use_expr == use) if (use_expr == use)
continue; continue;
if (is_gimple_debug (stmt))
{
if (gimple_debug_bind_p (stmt))
gimple_debug_bind_reset_value (stmt);
else
gcc_unreachable ();
break;
}
if (TREE_CODE (use_expr) != SSA_NAME) if (TREE_CODE (use_expr) != SSA_NAME)
{ {
tree var = create_tmp_var (type, "var"); tree var = create_tmp_var (type, "var");
......
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