[PATCH] D35035: [InstCombine] Prevent memcpy generation for small data size
DIVYA SHANMUGHAN via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 13:29:39 PDT 2017
DIVYA added a comment.
**TESTCASE1**
Before applying the patch
define void @foo(i8* %a, i8* %b) local_unnamed_addr #0 {
entry:
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 16, i32 1, i1 false)
ret void
}
After Applying the patch
define void @foo(i8* %a, i8* %b) local_unnamed_addr #0 {
entry:
%0 = bitcast i8* %b to i128*
%1 = bitcast i8* %a to i128*
%2 = load i128, i128* %0, align 1
store i128 %2, i128* %1, align 1
ret void
}
TESTCASE2
Before Applying the patch
%0 = bitcast i32* %add.ptr to i8*
%add.ptr3 = getelementptr inbounds [16 x i32], [16 x i32]* @b, i64 0, i64 %idx.ext
%1 = bitcast i32* %add.ptr3 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 16, i32 4, i1 false)
%inc = add nsw i32 %i.0, 1
After Applying the patch
%0 = bitcast i32* %add.ptr3 to i128*
%1 = bitcast i32* %add.ptr to i128*
%2 = load i128, i128* %0, align 16
store i128 %2, i128* %1, align 4
https://reviews.llvm.org/D35035
More information about the llvm-commits
mailing list