public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR80167
@ 2017-03-24 12:28 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2017-03-24 12:28 UTC (permalink / raw)
  To: gcc-patches


Seems we have simply forgotten about the case of replacing with a 
default-def.

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

Richard.

2017-03-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80167
	* graphite-isl-ast-to-gimple.c
	(translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs
	properly.
	(translate_isl_ast_to_gimple::get_rename): Likewise.

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

Index: gcc/graphite-isl-ast-to-gimple.c
===================================================================
*** gcc/graphite-isl-ast-to-gimple.c	(revision 246437)
--- gcc/graphite-isl-ast-to-gimple.c	(working copy)
*************** bool translate_isl_ast_to_gimple::
*** 1123,1128 ****
--- 1123,1131 ----
  is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
  		 phi_node_kind phi_kind, tree old_name, basic_block old_bb) const
  {
+   if (SSA_NAME_IS_DEFAULT_DEF (rename))
+     return true;
+ 
    /* The def of the rename must either dominate the uses or come from a
       back-edge.  Also the def must respect the loop closed ssa form.  */
    if (!is_loop_closed_ssa_use (use_bb, rename))
*************** get_rename (basic_block new_bb, tree old
*** 1178,1183 ****
--- 1181,1187 ----
  	  basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (rename));
  	  if (is_valid_rename (rename, bb, new_bb, phi_kind, old_name, old_bb)
  	      && (phi_kind == close_phi
+ 		  || ! bb
  		  || flow_bb_inside_loop_p (bb->loop_father, new_bb)))
  	    return rename;
  	  return NULL_TREE;
Index: gcc/testsuite/gcc.dg/graphite/pr80167.c
===================================================================
*** gcc/testsuite/gcc.dg/graphite/pr80167.c	(nonexistent)
--- gcc/testsuite/gcc.dg/graphite/pr80167.c	(working copy)
***************
*** 0 ****
--- 1,24 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O2 -floop-nest-optimize" } */
+ 
+ typedef struct
+ {
+   short a;
+   short b;
+   short c;
+ } d;
+ extern d e[];
+ int f[8];
+ void
+ g (d *i)
+ {
+   int h = 0;
+   for (; h < 28; h++)
+     e[h].a = e[h].b = i[h].a;
+   h = 0;
+   for (; h < 8; h++)
+     f[h] = i[h].b + i[h].c;
+   h = 0;
+   for (; h < 8; h++)
+     f[h] = i[h].b;
+ }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-24 12:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 12:28 [PATCH] Fix PR80167 Richard Biener

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