This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] make vector CONSTRUCTOR with TREE_CONSTANT true, min invariant
Andrew Pinski <pinskia@gmail.com> writes:
> On Tue, 2006-12-19 at 18:57 -0800, Ian Lance Taylor wrote:
> > Andrew Pinski <pinskia@gmail.com> writes:
> >
> > > We should treat vector CONSTRUCTOR with TREE_CONSTANT set as min
> > > invariant since we no longer look into them to gimplify them and they
> > > are constants so we should be able to treat them as such now.
> >
> > gimplify_init_constructor in gimplify.c finds it necessary to check
> > each value. It seems to me that code like would be required here,
> > too. Which may make it inappropriate.
>
> > In general it seems to me that we should find some way to pass these
> > CONSTRUCTORs to build_vector_from_ctor. It doesn't seem reasonable to
> > try to work around the fact that we don't do that.
>
> Yes we check each element for a constant tree but we also don't look
> past a TREE_CONSTANT vector CONSTRUCTOR when gimplifing any more:
> > /* Don't reduce a TREE_CONSTANT vector ctor even if we can't
> > make a VECTOR_CST. It won't do anything for us, and it'll
> > prevent us from representing it as a single constant. */
>
> Which seems like we should make this case still a min invariant as
> explained by the above comment which is in gimplify_init_constructor.
Hmmm, OK.
Your patch is OK provided you change it to not fall through to the
default case.
Thanks.
Ian