[llvm-commits] [llvm] r48680 - in /llvm/trunk: lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/form-memset.ll

Chris Lattner clattner at apple.com
Mon Mar 24 14:08:31 PDT 2008


On Mar 22, 2008, at 9:06 PM, Evan Cheng wrote:

> The idea is the turn consecutive loads and stores to memcpy and
> memset. Codegen is responsible for turning them back into loads and
> stores when appropriate.

To be concrete, we've seen user code that looks like:

char array[8];
...
array[0] = -1; // why are they doing this manually!!!
array[1] = -1;
array[2] = -1;
array[3] = -1;
array[4] = -1;
array[5] = -1;
array[6] = -1;
array[7] = -1;

Without the memset hack, we emit 8 1-byte stores.  With the hack we  
emit a single 8-byte store on 64-bit systems or 2 32-bit stores on 32- 
bit systems.  This is smaller and faster in many cases.  The problem  
is that it horks the optimizer in some cases (because it isn't  
aggressive enough with memset) which is why evan disabled my stuff for  
now.

-Chris



More information about the llvm-commits mailing list