[patch] for PR23509

Andrew Pinski pinskia@physics.uc.edu
Sat Aug 27 13:57:00 GMT 2005


On Aug 27, 2005, at 8:16 AM, Zdenek Dvorak wrote:

> Hello,
>
> the patch
>
> http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00283.html
>
> removed the check that prevents propagation of pointers
> when phi nodes are removed during basic block merging.
> This PR occurs in situation like
>
> p = phi(q);
> # VUSE (something)
> use (*p);
>
> when q is not dereferenced anywhere.  The pointers that are
> not dereferenced at all have neither name_mem_tag nor type_mem_tag
> set.  Therefore, when the code is replaced with
>
> use(*q);
>
> we lose the VUSE, which could in worst case lead to misscompilations.
> In this particular case it only confuses ivopts that expect 
> name_mem_tag
> or type_mem_tag to be set for every dereferenced pointer, and leads to
> ICE.

Then how does copy prop works?  This is exactly what copy prop does
and I don't see we losing VUSE there.  This looks more like a bug in
IV-OPTs not recording the aliasing info right when it transforms the
loop.

I tried the following examples (I disabled forwpropand ccp so we don't
prop &a into *d):

int f(int a)
{
   int *c = &a;
   int *b = c;
   int *d = c;
   return *d;
}

int f1(int *a)
{
   int *c = a;
   int *b = c;
   int *d = c;
   return *d;
}

Thanks,
Andrew Pinski



More information about the Gcc-patches mailing list