public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR84399
@ 2018-02-16  8:16 Richard Biener
  2018-02-19 14:49 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2018-02-16  8:16 UTC (permalink / raw)
  To: gcc-patches


Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2018-02-16  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84399
	* graphite-scop-detection.c (scop_detection::stmt_simple_for_scop_p):
	For operands we can analyze at their definition make sure we can
	analyze them at each use as well.

	* gcc.dg/graphite/pr84399.c: New testcase.

Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c	(revision 257682)
+++ gcc/graphite-scop-detection.c	(working copy)
@@ -1027,7 +1027,23 @@ scop_detection::stmt_simple_for_scop_p (
 
     case GIMPLE_ASSIGN:
     case GIMPLE_CALL:
-      return true;
+      {
+	tree op;
+	ssa_op_iter i;
+	/* Verify that if we can analyze operands at their def site we
+	   also can represent them when analyzed at their uses.  */
+	FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_USE)
+	  if (scev_analyzable_p (op, scop)
+	      && !graphite_can_represent_expr (scop, bb->loop_father, op))
+	    {
+	      DEBUG_PRINT (dp << "[scop-detection-fail] "
+			   << "Graphite cannot represent stmt:\n";
+			   print_gimple_stmt (dump_file, stmt, 0,
+					      TDF_VOPS | TDF_MEMSYMS));
+	      return false;
+	    }
+	return true;
+      }
 
     default:
       /* These nodes cut a new scope.  */
Index: gcc/testsuite/gcc.dg/graphite/pr84399.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/pr84399.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/graphite/pr84399.c	(working copy)
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize -fno-tree-loop-im --param scev-max-expr-size=1" } */
+
+void
+h8 (int cv, int od)
+{
+  for (;;)
+    {
+      int ih = (__UINTPTR_TYPE__)&od;
+      if (cv == 0)
+	while (od < 1)
+	  {
+	    int lq;
+
+	    for (lq = 0; lq < 3; ++lq)
+	      for (ih = 0; ih < 4; ++ih)
+		od += lq;
+	  }
+      while (ih < 1)
+	{
+	}
+    }
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PR84399
  2018-02-16  8:16 [PATCH] Fix PR84399 Richard Biener
@ 2018-02-19 14:49 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2018-02-19 14:49 UTC (permalink / raw)
  To: Richard Biener, gcc-patches; +Cc: nd

On 16/02/18 08:15, Richard Biener wrote:
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
> 
> Richard.
> 
> 2018-02-16  Richard Biener  <rguenther@suse.de>
> 
> 	PR tree-optimization/84399
> 	* graphite-scop-detection.c (scop_detection::stmt_simple_for_scop_p):
> 	For operands we can analyze at their definition make sure we can
> 	analyze them at each use as well.
> 
> 	* gcc.dg/graphite/pr84399.c: New testcase.
> 

since this commit (r257723) i see

FAIL: libgomp.graphite/force-parallel-8.c scan-tree-dump-times graphite "5 loops carried no dependency" 1 (found 0 times)

on aarch64-none-linux-gnu and arm-none-linux-gnueabihf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-19 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-16  8:16 [PATCH] Fix PR84399 Richard Biener
2018-02-19 14:49 ` Szabolcs Nagy

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).