[PATCH] Remove dead zero store to calloc initialized memory

Philip Reames listmail at philipreames.com
Thu May 29 11:53:18 PDT 2014


(Again, this doesn't appear to have gone to the commits list.  Anyone 
have a clue what's I'm doing wrong here?)

Remove dead zero store to calloc initialized memory

http://reviews.llvm.org/D3942

Optimize the following IR:

%1  =  tail  call  noalias  i8*  @calloc(i64  1,  i64  4)
%2  =  bitcast  i8*  %1  to  i32*
;  This  store  is  dead  and  should  be  removed
store  i32  0,  i32*  %2,  align  4

Memory returned by calloc is guaranteed to be zero initialized. If the 
value being stored is the constant zero (and the store is not otherwise 
observable across threads), we can delete the store.

Note: I do not have commit rights and will need someone to commit this 
change after review.

Philip

-------------- next part --------------
A non-text attachment was scrubbed...
Name: calloc-dead-store.diff
Type: text/x-patch
Size: 2440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140529/5e89e832/attachment.bin>


More information about the llvm-commits mailing list