Skip to content

Fix TypeInfo.assignArrayWithTake #11928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/IRGen/GenValueWitness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ void TypeInfo::assignArrayWithCopyBackToFront(IRGenFunction &IGF, Address dest,
void TypeInfo::assignArrayWithTake(IRGenFunction &IGF, Address dest,
Address src, llvm::Value *count,
SILType T) const {
if (isBitwiseTakable(ResilienceExpansion::Maximal)) {
if (isPOD(ResilienceExpansion::Maximal)) {
llvm::Value *stride = getStride(IGF, T);
llvm::Value *byteCount = IGF.Builder.CreateNUWMul(stride, count);
IGF.Builder.CreateMemCpy(dest.getAddress(), src.getAddress(), byteCount,
Expand Down
11 changes: 5 additions & 6 deletions test/IRGen/builtins.swift
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,7 @@ func copyPODArray(_ dest: Builtin.RawPointer, src: Builtin.RawPointer, count: Bu
// CHECK: call void @swift_arrayAssignWithCopyNoAlias(
// CHECK: call void @swift_arrayAssignWithCopyFrontToBack(
// CHECK: call void @swift_arrayAssignWithCopyBackToFront(
// CHECK: mul nuw i64 8, %2
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 {{.*}}, i32 8, i1 false)
// CHECK: call void @swift_arrayAssignWithTake(
func copyBTArray(_ dest: Builtin.RawPointer, src: Builtin.RawPointer, count: Builtin.Word) {
Builtin.copyArray(C.self, dest, src, count)
Builtin.takeArrayFrontToBack(C.self, dest, src, count)
Expand Down Expand Up @@ -544,10 +543,10 @@ func copyGenArray<T>(_ dest: Builtin.RawPointer, src: Builtin.RawPointer, count:
Builtin.copyArray(T.self, dest, src, count)
Builtin.takeArrayFrontToBack(T.self, dest, src, count)
Builtin.takeArrayBackToFront(T.self, dest, src, count)
Builtin.assignCopyArrayNoAlias(W.self, dest, src, count)
Builtin.assignCopyArrayFrontToBack(W.self, dest, src, count)
Builtin.assignCopyArrayBackToFront(W.self, dest, src, count)
Builtin.assignTakeArray(W.self, dest, src, count)
Builtin.assignCopyArrayNoAlias(T.self, dest, src, count)
Builtin.assignCopyArrayFrontToBack(T.self, dest, src, count)
Builtin.assignCopyArrayBackToFront(T.self, dest, src, count)
Builtin.assignTakeArray(T.self, dest, src, count)
}

// CHECK-LABEL: define hidden {{.*}}void @_T08builtins24conditionallyUnreachableyyF
Expand Down