This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Allow tree-ssa Forward Prop to produce VIEW_CONVERT_EXPR in some cases
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Andrew Pinski" <pinskia at gmail dot com>
- Cc: "Gcc Patch List" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 2 May 2008 11:25:53 +0200
- Subject: Re: [PATCH] Allow tree-ssa Forward Prop to produce VIEW_CONVERT_EXPR in some cases
- References: <de8d50360805012032l510a8ef7l600d29c521bfe875@mail.gmail.com>
On Fri, May 2, 2008 at 5:32 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> While looking into PR 26069, I had posted a patch which made
> fold_indirect_ref create a VIEW_CONVERT_EXPR, but that failed because
> using VCE on the lhs side has some issues as we could produce a subreg
> like setting. So Instead I decided to add to forwprop a way to
> produce it. I first did this for the PS3 toolchain which is GCC 4.1.1
> based and then I redid it for the trunk where the code has changed a
> lot and actually made it easier to do already. We now are able to
> convert *(int*)&float_var into a VIEW_CONVERT_EXPR (we still get a
> warning about aliasing violation which is why I requested that we kept
> the warning in the front-end for this case :)) and get the behavior
> what users would expect.
>
> OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
It looks like this will now refuse to forwprop
struct X { int a[5]; };
int foo(struct X *q)
{
int (*p)[5] = &q->a;
return (*p)[0];
}
?
It also looks it will now forwprop
int i;
int foo(void)
{
volatile int *p = (volatile int *)&i;
return *p + *p;
}
to VIEW_CONVERT_EXPR <volatile int>(i) -- I don't think that V_C_E
is designed to carry changes just in CV qualifiers.
Also if you cannot use fold_build1 because of the invalid gimple issue,
won't you run into this problem with fold_stmt as well? Will 'i' become
non-addressable at any time if it is used in a V_C_E? Do we fold it
then?
Thanks,
Richard.