public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>, Martin Jambor <mjambor@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix ab SSA_NAME handling in eipa_sra replace_removed_params_ssa_names (PR tree-optimization/70152)
Date: Wed, 09 Mar 2016 17:02:00 -0000	[thread overview]
Message-ID: <20160309170226.GN3017@tucnak.redhat.com> (raw)

Hi!

If a parameter is unused, eipa_sra replaces the SSA_NAMEs with that
PARM_DECL SSA_NAME_VAR with SSA_NAMEs with a VAR_DECL instead.
IMHO it is fine to do that even when all or some of its SSA_NAMEs
are (ab), but we need to copy that flag over.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/70152
	* tree-sra.c (replace_removed_params_ssa_names): Copy over
	SSA_NAME_OCCURS_IN_ABNORMAL_PHI from old_name to new_name.

	* gcc.dg/pr70152.c: New test.

--- gcc/tree-sra.c.jj	2016-02-26 20:30:21.000000000 +0100
+++ gcc/tree-sra.c	2016-03-09 10:55:23.628924709 +0100
@@ -4758,6 +4758,8 @@ replace_removed_params_ssa_names (tree o
 
   repl = get_replaced_param_substitute (adj);
   new_name = make_ssa_name (repl, stmt);
+  SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_name)
+    = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (old_name);
 
   if (dump_file)
     {
--- gcc/testsuite/gcc.dg/pr70152.c.jj	2016-03-09 11:04:33.704398525 +0100
+++ gcc/testsuite/gcc.dg/pr70152.c	2016-03-09 11:04:51.815150732 +0100
@@ -0,0 +1,27 @@
+/* PR tree-optimization/70152 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a;
+int foo (void);
+int setjmp (char *);
+char buf[64];
+
+static int
+bar (int x)
+{
+  x = 0;
+  setjmp (buf);
+  for (;;)
+    {
+    switch (x)
+      case 5:
+	x = foo ();
+    }
+}
+
+void
+baz (void)
+{
+  bar (a);
+}

	Jakub

             reply	other threads:[~2016-03-09 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 17:02 Jakub Jelinek [this message]
2016-03-09 17:51 ` 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=20160309170226.GN3017@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    --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).