This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A question about redudant load elimination
- From: Michael Matz <matz at suse dot de>
- To: Jeff Law <law at redhat dot com>
- Cc: Richard Guenther <richard dot guenther at gmail dot com>, Jiangning Liu <jiangning dot liu at arm dot com>, gcc at gcc dot gnu dot org
- Date: Wed, 16 Nov 2011 18:31:42 +0100 (CET)
- Subject: Re: A question about redudant load elimination
- References: <4ec0cb02.a424440a.6fba.ffffb618SMTPIN_ADDED@mx.google.com> <CAFiYyc1enGX_gk0swvaXc9t=YUMUvJiZ-EidL3KRXT9TqDaZ1A@mail.gmail.com> <4EC3ED1D.5010200@redhat.com>
Hi,
On Wed, 16 Nov 2011, Jeff Law wrote:
> Right. In theory, path isolation would make this optimizable. Make a
> copy of the block containing a[x] = 2 and make it the target when x !=
> 100. At the source level it'd look something like this:
>
> int x;
> extern void f(void);
>
> void g(int *a)
> {
> a[x] = 1;
> if (x == 100) {
> f();
> a[x] = 2;
> } else {
> a[x] = 2;
> }
> }
>
>
> The problem then becomes identification of the load from "x" as
> redundant on the else path, which we're currently not capable of doing.
Also in this variant the first store to a[x] may-clobbers x itself. The
function call doesn't enter the picture.
Ciao,
Michael.