public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ab SSA_NAME handling in eipa_sra replace_removed_params_ssa_names (PR tree-optimization/70152)
@ 2016-03-09 17:02 Jakub Jelinek
  2016-03-09 17:51 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-03-09 17:02 UTC (permalink / raw)
  To: Richard Biener, Martin Jambor; +Cc: gcc-patches

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

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

* Re: [PATCH] Fix ab SSA_NAME handling in eipa_sra replace_removed_params_ssa_names (PR tree-optimization/70152)
  2016-03-09 17:02 [PATCH] Fix ab SSA_NAME handling in eipa_sra replace_removed_params_ssa_names (PR tree-optimization/70152) Jakub Jelinek
@ 2016-03-09 17:51 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-03-09 17:51 UTC (permalink / raw)
  To: Jakub Jelinek, Martin Jambor; +Cc: gcc-patches

On March 9, 2016 6:02:26 PM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>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?

OK.

Richard.

>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


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

end of thread, other threads:[~2016-03-09 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 17:02 [PATCH] Fix ab SSA_NAME handling in eipa_sra replace_removed_params_ssa_names (PR tree-optimization/70152) Jakub Jelinek
2016-03-09 17:51 ` 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).