[LLVMdev] Another missed optimization opportunity?

Scott Pakin pakin at lanl.gov
Wed Apr 24 14:21:04 PDT 2013


On 04/24/2013 02:31 PM, Dan Gohman wrote:
> The semantic reason is that the optimizer is required to assume that the i32 stores could be storing to the storage of myarray. LLVM IR does not permit optimizers to optimize based on the nominal types of memory objects or memory accesses.
>
> This gets optimized in C, because the C compiler adds special TBAA metadata annotations to the loads and stores which say that the stores of "int" do not interfere with the loads of "pointer". It also gets optimized if myarray is const, because the optimizer knows that const memory is not modified by stores. It also gets optimized if myarray is an actual array, because then the address of the array is constant, rather than being a value loaded from memory.

Ah.  Very helpful answer; thanks.

-- Scott




More information about the llvm-dev mailing list