Fix PR84466

Message ID alpine.LSU.2.20.1802271543580.18265@zhemvz.fhfr.qr
State New
Headers show
Series
  • Fix PR84466
Related show

Commit Message

Richard Biener Feb. 27, 2018, 2:44 p.m.
The following fixes PR84466.

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

Richard.

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

	PR tree-optimization/84466
	* graphite-scop-detection.c (scop_detection::stmt_simple_for_scop_p):
	Adjust last change to less strictly validate use operands.

Patch

Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c	(revision 258030)
+++ gcc/graphite-scop-detection.c	(working copy)
@@ -1028,16 +1028,23 @@  scop_detection::stmt_simple_for_scop_p (
     case GIMPLE_ASSIGN:
     case GIMPLE_CALL:
       {
-	tree op;
+	tree op, lhs = gimple_get_lhs (stmt);
 	ssa_op_iter i;
+	/* If we are not going to instantiate the stmt do not require
+	   its operands to be instantiatable at this point.  */
+	if (lhs
+	    && TREE_CODE (lhs) == SSA_NAME
+	    && scev_analyzable_p (lhs, scop))
+	  return true;
 	/* 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))
+	      && chrec_contains_undetermined
+		   (scalar_evolution_in_region (scop, bb->loop_father, op)))
 	    {
 	      DEBUG_PRINT (dp << "[scop-detection-fail] "
-			   << "Graphite cannot represent stmt:\n";
+			   << "Graphite cannot code-gen stmt:\n";
 			   print_gimple_stmt (dump_file, stmt, 0,
 					      TDF_VOPS | TDF_MEMSYMS));
 	      return false;