diff mbox

Fix for PR64353

Message ID 20150114131904.GA56209@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich Jan. 14, 2015, 2:28 p.m. UTC
Hi,

SRA gimple passes may add loads to functions with no SSA update.  Later it causes ICE when function with not updated SSA is processed by gimple passes.  This patch fixes it by calling update_ssa.

Bootstrapped and checked on x86_64-unknown-linux-gnu.  OK for trunk?

Thanks,
Ilya
--
gcc/

2015-01-14  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR middle-end/64353
	* ipa-prop.c (ipa_modify_call_arguments): Update SSA for
	vops after adding a load.


gcc/testsuite/

2015-01-14  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR middle-end/64353
	* g++.dg/pr64353.C: New.

Comments

Richard Biener Jan. 14, 2015, 2:35 p.m. UTC | #1
On Wed, Jan 14, 2015 at 3:28 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> Hi,
>
> SRA gimple passes may add loads to functions with no SSA update.  Later it causes ICE when function with not updated SSA is processed by gimple passes.  This patch fixes it by calling update_ssa.
>
> Bootstrapped and checked on x86_64-unknown-linux-gnu.  OK for trunk?

No.  I have removed this quadratic update-ssa call previously.  It should
simply keep SSA for up-to-date manually (see how it does gimple_set_vuse
in some cases, probably not all required ones?).

Richard.

> Thanks,
> Ilya
> --
> gcc/
>
> 2015-01-14  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         PR middle-end/64353
>         * ipa-prop.c (ipa_modify_call_arguments): Update SSA for
>         vops after adding a load.
>
>
> gcc/testsuite/
>
> 2015-01-14  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         PR middle-end/64353
>         * g++.dg/pr64353.C: New.
>
>
> diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
> index 01f4111..533dcfe 100644
> --- a/gcc/ipa-prop.c
> +++ b/gcc/ipa-prop.c
> @@ -4054,6 +4054,8 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
>                     expr = create_tmp_reg (TREE_TYPE (expr));
>                   gimple_assign_set_lhs (tem, expr);
>                   gsi_insert_before (&gsi, tem, GSI_SAME_STMT);
> +                 if (gimple_in_ssa_p (cfun))
> +                   update_ssa (TODO_update_ssa_only_virtuals);
>                 }
>             }
>           else
> diff --git a/gcc/testsuite/g++.dg/pr64353.C b/gcc/testsuite/g++.dg/pr64353.C
> new file mode 100644
> index 0000000..7859918
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/pr64353.C
> @@ -0,0 +1,15 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +
> +class C
> +{
> +  int y, x;
> +  void i ();
> +  bool __attribute__((const)) xx () { return x; }
> +};
> +
> +void C::i ()
> +{
> +  if (xx ())
> +    x = 1;
> +}
diff mbox

Patch

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 01f4111..533dcfe 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4054,6 +4054,8 @@  ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
 		    expr = create_tmp_reg (TREE_TYPE (expr));
 		  gimple_assign_set_lhs (tem, expr);
 		  gsi_insert_before (&gsi, tem, GSI_SAME_STMT);
+		  if (gimple_in_ssa_p (cfun))
+		    update_ssa (TODO_update_ssa_only_virtuals);
 		}
 	    }
 	  else
diff --git a/gcc/testsuite/g++.dg/pr64353.C b/gcc/testsuite/g++.dg/pr64353.C
new file mode 100644
index 0000000..7859918
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr64353.C
@@ -0,0 +1,15 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+class C
+{
+  int y, x;
+  void i ();
+  bool __attribute__((const)) xx () { return x; }
+};
+
+void C::i ()
+{
+  if (xx ())
+    x = 1;
+}