public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, PR69426] Fix clobber removal in parloops
@ 2016-01-23  9:35 Tom de Vries
  2016-01-23  9:41 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2016-01-23  9:35 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

Hi,

this patches fixes a 5/6 regression PR69426.

When compiling the test-case in the patch, the verify_ssa todo check 
fails after removing a clobber in eliminate_local_variables_stmt.

The problem is that the clobber is removed, but the uses of the 
corresponding vdef are not changed, and the virtual symbol is not marked 
for renaming.

[ The same happens in 4.9, but because omp_expand_local is called before 
verify_ssa, the ICE does not happen. In 5.0 and later, we use a separate 
expand_omp_ssa pass. ]

This patch fixes the problem by replacing the uses of the vdef of the 
clobber by the vuse of the clobber.

The patch uses replace_uses_by, but unlink_vdef_stmt also works, I'm not 
sure which one to use.

Bootstrapped and reg-tested on x86_64.

OK for trunk, gcc-5-branch?

Thanks,
- Tom

[-- Attachment #2: 0001-Fix-clobber-removal-in-parloops.patch --]
[-- Type: text/x-patch, Size: 1317 bytes --]

Fix clobber removal in parloops

2016-01-23  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/69426
	* tree-parloops.c (eliminate_local_variables_stmt): Handle vdef of
	removed clobber.

	* gcc.dg/autopar/pr69426.c: New test.

---
 gcc/testsuite/gcc.dg/autopar/pr69426.c | 19 +++++++++++++++++++
 gcc/tree-parloops.c                    |  1 +
 2 files changed, 20 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/autopar/pr69426.c b/gcc/testsuite/gcc.dg/autopar/pr69426.c
new file mode 100644
index 0000000..e91421c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/autopar/pr69426.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
+
+int iq;
+
+void
+mr(void)
+{
+  unsigned int i8;
+
+  for (i8 = 0; i8 != 1; i8 += 3) {
+    void *f0[] = { f0 };
+    int hv;
+
+    for (; hv < 1; ++hv)
+      iq = 0;
+  }
+  ++iq;
+}
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 7749d34..f9db43b 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -725,6 +725,7 @@ eliminate_local_variables_stmt (edge entry, gimple_stmt_iterator *gsi,
     }
   else if (gimple_clobber_p (stmt))
     {
+      replace_uses_by (gimple_vdef (stmt), gimple_vuse (stmt));
       stmt = gimple_build_nop ();
       gsi_replace (gsi, stmt, false);
       dta.changed = true;

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

* Re: [PATCH, PR69426] Fix clobber removal in parloops
  2016-01-23  9:35 [PATCH, PR69426] Fix clobber removal in parloops Tom de Vries
@ 2016-01-23  9:41 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-01-23  9:41 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gcc-patches

On January 23, 2016 10:34:46 AM GMT+01:00, Tom de Vries <Tom_deVries@mentor.com> wrote:
>Hi,
>
>this patches fixes a 5/6 regression PR69426.
>
>When compiling the test-case in the patch, the verify_ssa todo check 
>fails after removing a clobber in eliminate_local_variables_stmt.
>
>The problem is that the clobber is removed, but the uses of the 
>corresponding vdef are not changed, and the virtual symbol is not
>marked 
>for renaming.
>
>[ The same happens in 4.9, but because omp_expand_local is called
>before 
>verify_ssa, the ICE does not happen. In 5.0 and later, we use a
>separate 
>expand_omp_ssa pass. ]
>
>This patch fixes the problem by replacing the uses of the vdef of the 
>clobber by the vuse of the clobber.
>
>The patch uses replace_uses_by, but unlink_vdef_stmt also works, I'm
>not 
>sure which one to use.

Unlink_stmt_vdef please.

OK with that change.

Richard.

>Bootstrapped and reg-tested on x86_64.
>
>OK for trunk, gcc-5-branch?
>
>Thanks,
>- Tom


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

end of thread, other threads:[~2016-01-23  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-23  9:35 [PATCH, PR69426] Fix clobber removal in parloops Tom de Vries
2016-01-23  9:41 ` 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).