Commit 33df361a by Sebastian Pop Committed by Sebastian Pop

dump reasons why graphite failed to detect a scop

When trying to analyze why Graphite does not handle a loop nest, it is easy to
look in the dumps of -fdump-tree-graphite-all to guess what has to be changed to
catch the loop.  This patch makes the dumps a bit more verbose and useful.

	* graphite-scop-detection.c: Include gimple-pretty-print.h.
	(stmt_simple_for_scop_p): Print when a stmt is not handled in Graphite.
	(scopdet_basic_block_info): Print when a loop or bb cannot be
	represented in Graphite.

From-SVN: r226213
parent 4c141304
2015-07-25 Sebastian Pop <s.pop@samsung.com>
* graphite-scop-detection.c: Include gimple-pretty-print.h.
(stmt_simple_for_scop_p): Print when a stmt is not handled in
Graphite.
(scopdet_basic_block_info): Print when a loop or bb cannot be
represented in Graphite.
2015-07-25 Uros Bizjak <ubizjak@gmail.com> 2015-07-25 Uros Bizjak <ubizjak@gmail.com>
PR target/66648 PR target/66648
......
...@@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see
#include "graphite-poly.h" #include "graphite-poly.h"
#include "tree-ssa-propagate.h" #include "tree-ssa-propagate.h"
#include "graphite-scop-detection.h" #include "graphite-scop-detection.h"
#include "gimple-pretty-print.h"
/* Forward declarations. */ /* Forward declarations. */
static void make_close_phi_nodes_unique (basic_block); static void make_close_phi_nodes_unique (basic_block);
...@@ -350,13 +351,31 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop, ...@@ -350,13 +351,31 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop,
|| (gimple_code (stmt) == GIMPLE_CALL || (gimple_code (stmt) == GIMPLE_CALL
&& !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE))) && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
|| (gimple_code (stmt) == GIMPLE_ASM)) || (gimple_code (stmt) == GIMPLE_ASM))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "Graphite cannot handle this stmt:\n");
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS);
}
return false; return false;
}
if (is_gimple_debug (stmt)) if (is_gimple_debug (stmt))
return true; return true;
if (!stmt_has_simple_data_refs_p (outermost_loop, stmt)) if (!stmt_has_simple_data_refs_p (outermost_loop, stmt))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "Graphite cannot handle data-refs in stmt:\n");
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS);
}
return false; return false;
}
switch (gimple_code (stmt)) switch (gimple_code (stmt))
{ {
...@@ -375,7 +394,16 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop, ...@@ -375,7 +394,16 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop,
|| code == GE_EXPR || code == GE_EXPR
|| code == EQ_EXPR || code == EQ_EXPR
|| code == NE_EXPR)) || code == NE_EXPR))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "Graphite cannot handle cond stmt:\n");
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS);
}
return false; return false;
}
for (unsigned i = 0; i < 2; ++i) for (unsigned i = 0; i < 2; ++i)
{ {
...@@ -383,8 +411,17 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop, ...@@ -383,8 +411,17 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop,
if (!graphite_can_represent_expr (scop_entry, loop, op) if (!graphite_can_represent_expr (scop_entry, loop, op)
/* We can not handle REAL_TYPE. Failed for pr39260. */ /* We can not handle REAL_TYPE. Failed for pr39260. */
|| TREE_CODE (TREE_TYPE (op)) == REAL_TYPE) || TREE_CODE (TREE_TYPE (op)) == REAL_TYPE)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "Graphite cannot represent stmt:\n");
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS);
}
return false; return false;
} }
}
return true; return true;
} }
...@@ -395,6 +432,12 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop, ...@@ -395,6 +432,12 @@ stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop,
default: default:
/* These nodes cut a new scope. */ /* These nodes cut a new scope. */
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "Gimple stmt not handled in Graphite:\n");
print_gimple_stmt (dump_file, stmt, 0, TDF_VOPS|TDF_MEMSYMS);
}
return false; return false;
} }
...@@ -488,7 +531,16 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop, ...@@ -488,7 +531,16 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
with make_forwarder_block. */ with make_forwarder_block. */
if (!single_succ_p (bb) if (!single_succ_p (bb)
|| bb_has_abnormal_pred (single_succ (bb))) || bb_has_abnormal_pred (single_succ (bb)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "BB %d cannot be part of a scop.\n",
bb->index);
}
result.difficult = true; result.difficult = true;
}
else else
result.exit = single_succ (bb); result.exit = single_succ (bb);
...@@ -509,7 +561,15 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop, ...@@ -509,7 +561,15 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
sinfo = build_scops_1 (bb, outermost_loop, &regions, loop); sinfo = build_scops_1 (bb, outermost_loop, &regions, loop);
if (!graphite_can_represent_loop (entry_block, loop)) if (!graphite_can_represent_loop (entry_block, loop))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "Graphite cannot represent loop %d.\n",
loop->num);
}
result.difficult = true; result.difficult = true;
}
result.difficult |= sinfo.difficult; result.difficult |= sinfo.difficult;
......
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