diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-02 01:58:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-02 01:58:41 +0000 |
commit | e6af88628fabe91b8a63b98b82006dd07bd50df5 (patch) | |
tree | a9c2aab57a24cee170c139a5a0ad4872e51edf08 /clang/lib/Basic/FileSystemStatCache.cpp | |
parent | 68324f756d63845d81cb3ed946d0f08a3678f8b9 (diff) | |
download | llvm-e6af88628fabe91b8a63b98b82006dd07bd50df5.zip llvm-e6af88628fabe91b8a63b98b82006dd07bd50df5.tar.gz llvm-e6af88628fabe91b8a63b98b82006dd07bd50df5.tar.bz2 |
Enhance the init generation logic to emit a memset followed by a few stores when
a global is larger than 32 bytes and has fewer than 6 non-zero values in the
initializer. Previously we'd turn something like this:
char test8(int X) {
char str[10000] = "abc";
into a 10K global variable which we then memcpy'd from. Now we generate:
%str = alloca [10000 x i8], align 16
%tmp = getelementptr inbounds [10000 x i8]* %str, i64 0, i64 0
call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 10000, i32 16, i1 false)
store i8 97, i8* %tmp, align 16
%0 = getelementptr [10000 x i8]* %str, i64 0, i64 1
store i8 98, i8* %0, align 1
%1 = getelementptr [10000 x i8]* %str, i64 0, i64 2
store i8 99, i8* %1, align 2
Which is much smaller in space and also likely faster.
This is part of PR279
llvm-svn: 120645
Diffstat (limited to 'clang/lib/Basic/FileSystemStatCache.cpp')
0 files changed, 0 insertions, 0 deletions