This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix for PR64353
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 14 Jan 2015 19:23:21 +0300
- Subject: Re: [PATCH] Fix for PR64353
- Authentication-results: sourceware.org; auth=none
- References: <20150114131904 dot GA56209 at msticlxl57 dot ims dot intel dot com> <CAFiYyc17GPgUgGAjJzh_1qPyCG9sbM6uemQtG2aekNrySKEj7A at mail dot gmail dot com>
On 14 Jan 15:35, Richard Biener wrote:
> 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?).
>
Would it be OK to call update_ssa only in case we don't have a proper VUSE for call? Are we allowed to just emit error due to incorrect attribute?
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 01f4111..4ce7822 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4054,6 +4054,11 @@ 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);
+ /* In case callee has a wrong __attribute__((const))
+ we may have no VUSE for the call and thus require
+ SSA update for the inserted load. See PR64353. */
+ if (gimple_in_ssa_p (cfun) && !gimple_vuse (stmt))
+ update_ssa (TODO_update_ssa_only_virtuals);
}
}
else
Thanks,
Ilya
> 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;
> > +}