public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Richard Biener <rguenther@suse.de>
Cc: "gcc-patches@gnu.org" <gcc-patches@gnu.org>
Subject: [PATCH, PR69426] Fix clobber removal in parloops
Date: Sat, 23 Jan 2016 09:35:00 -0000	[thread overview]
Message-ID: <56A34936.1040004@mentor.com> (raw)

[-- 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;

             reply	other threads:[~2016-01-23  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-23  9:35 Tom de Vries [this message]
2016-01-23  9:41 ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A34936.1040004@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).