This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A question about redudant load elimination


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]