diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-06-12 21:16:19 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-06-12 21:16:19 +0000 |
commit | fd5c553f54237715fbaf8b76736cef7f500c3abc (patch) | |
tree | 5973a607b3ca490955bba4d45ca58d46ce27ffcb /llvm/lib/Bitcode/Reader/BitstreamReader.cpp | |
parent | 5d47d4ac7e5d7f89916c901a09527a134261dd34 (diff) | |
download | bcm5719-llvm-fd5c553f54237715fbaf8b76736cef7f500c3abc.tar.gz bcm5719-llvm-fd5c553f54237715fbaf8b76736cef7f500c3abc.zip |
GVN: Enable value forwarding for calloc
Enable value forwarding for loads from `calloc()` without an intervening
store.
This change extends GVN to handle the following case:
%1 = tail call noalias i8* @calloc(i64 1, i64 4)
%2 = bitcast i8* %1 to i32*
; This load is trivially constant zero
%3 = load i32* %2, align 4
This is analogous to the handling for `malloc()` in the same places.
`malloc()` returns `undef`; `calloc()` returns a zero value. Note that
it is correct to return zero even for out of bounds GEPs since the
result of such a GEP would be undefined.
Patch by Philip Reames!
llvm-svn: 210828
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitstreamReader.cpp')
0 files changed, 0 insertions, 0 deletions