public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/107153 - autopar SSA update issue
@ 2022-10-07 12:26 Richard Biener
  2022-10-10 10:07 ` Require fgraphite effective target for pr107153.c test [PR107153] Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2022-10-07 12:26 UTC (permalink / raw)
  To: gcc-patches

autopar performs insertion of stores, eventually requiring a
virtual loop PHI and assorted LC PHI adjustments which we intend
to do once after the pass finishes.  But we also perform intermediate
update_ssa after loop duplication which can lose this fact.  The
following forces renaming of the virtual operand before the final
SSA update to fix that.  It also removes the explicit update_ssa
call from the gimple_duplicate_sese_tail utility as has been done
for all other such utilities and instead performs the SSA update
from autopar.

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

	PR tree-optimization/107153
	* tree-cfg.cc (gimple_duplicate_sese_tail): Do not update
	SSA form here.
	* tree-parloops.cc (gen_parallel_loop): Update SSA form
	after to-exit-first transform, no PHI insertion is necessary.
	(pass_parallelize_loops::execute): Force re-write of the
	virtual operand SSA web.

	* gcc.dg/autopar/pr107153.c: New testcase.
---
 gcc/testsuite/gcc.dg/autopar/pr107153.c | 17 +++++++++++++++++
 gcc/tree-cfg.cc                         |  2 --
 gcc/tree-parloops.cc                    |  5 +++++
 3 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/autopar/pr107153.c

diff --git a/gcc/testsuite/gcc.dg/autopar/pr107153.c b/gcc/testsuite/gcc.dg/autopar/pr107153.c
new file mode 100644
index 00000000000..2391a674d63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/autopar/pr107153.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -floop-parallelize-all -ftree-parallelize-loops=2 -fno-tree-dominator-opts" } */
+
+void
+foo (int x, int y)
+{
+  int i;
+
+  for (i = 0; i < 2; i++)
+    {
+    }
+
+  while (x)
+    if (!y)
+      while (y)
+        ++y;
+}
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index 09fa7b64584..42f40f17c56 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -6926,8 +6926,6 @@ gimple_duplicate_sese_tail (edge entry, edge exit,
   /* Anything that is outside of the region, but was dominated by something
      inside needs to update dominance info.  */
   iterate_fix_dominators (CDI_DOMINATORS, doms, false);
-  /* Update the SSA web.  */
-  update_ssa (TODO_update_ssa);
 
   if (free_region_copy)
     free (region_copy);
diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index e4a148b5365..e680d97dd04 100644
--- a/gcc/tree-parloops.cc
+++ b/gcc/tree-parloops.cc
@@ -3131,6 +3131,7 @@ gen_parallel_loop (class loop *loop,
 	 to the exit of the loop.  */
       transform_to_exit_first_loop (loop, reduction_list, nit);
     }
+  update_ssa (TODO_update_ssa_no_phi);
 
   /* Generate initializations for reductions.  */
   if (!reduction_list->is_empty ())
@@ -4215,6 +4216,10 @@ pass_parallelize_loops::execute (function *fun)
 
       checking_verify_loop_structure ();
 
+      /* ???  Intermediate SSA updates with no PHIs might have lost
+	 the virtual operand renaming needed by separate_decls_in_region,
+	 make sure to rename them again.  */
+      mark_virtual_operands_for_renaming (fun);
       update_ssa (TODO_update_ssa);
       if (in_loop_pipeline)
 	rewrite_into_loop_closed_ssa (NULL, 0);
-- 
2.35.3

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

* Require fgraphite effective target for pr107153.c test [PR107153]
  2022-10-07 12:26 [PATCH] tree-optimization/107153 - autopar SSA update issue Richard Biener
@ 2022-10-10 10:07 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2022-10-10 10:07 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

On Fri, Oct 07, 2022 at 02:26:56PM +0200, Richard Biener via Gcc-patches wrote:
> 	* gcc.dg/autopar/pr107153.c: New testcase.

The test uses -floop-parallelize-all which emits a sorry when graphite
isn't configured in.

Tested on x86_64-linux and i686-linux, committed to trunk as obvious.

2022-10-10  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/107153
	* gcc.dg/autopar/pr107153.c: Require fgraphite effective target.

--- gcc/testsuite/gcc.dg/autopar/pr107153.c.jj	2022-10-10 09:31:57.664981573 +0200
+++ gcc/testsuite/gcc.dg/autopar/pr107153.c	2022-10-10 11:59:00.365605619 +0200
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target fgraphite } } */
 /* { dg-options "-O1 -floop-parallelize-all -ftree-parallelize-loops=2 -fno-tree-dominator-opts" } */
 
 void


	Jakub


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

end of thread, other threads:[~2022-10-10 10:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 12:26 [PATCH] tree-optimization/107153 - autopar SSA update issue Richard Biener
2022-10-10 10:07 ` Require fgraphite effective target for pr107153.c test [PR107153] Jakub Jelinek

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