[LLVMdev] Another missed optimization opportunity?

Scott Pakin pakin at lanl.gov
Wed Apr 24 14:23:38 PDT 2013


On 04/24/2013 02:35 PM, Caldarale, Charles R wrote:
> The myarray variable could be defined and initialized like this:
>
>      int* myarray = ((int*)&myarray) - 5;
>
> If the initialization occurs external to the module with the incrementation function, the optimizers must assume such silliness is possible in lieu of any information to the contrary, so aliasing can occur.

I see.  Pretty evil stuff.  But that does explain how three myarray[5]++'s
can potentially be different from one myarray[5]+=3.

Thanks for the example,
-- Scott




More information about the llvm-dev mailing list