mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Both the syntax and relative order of the LLVM `nocapture` parameter attribute changed upstream in 29441e4f5fa5f5c7709f7cf180815ba97f611297. To reduce conflicts with rebranch, adjust FileCheck patterns to expect both syntaxes and orders anywhere the presence of the attribute is not critical to the test. These changes are temporary and will be cleaned up once rebranch is merged into main.
54 lines
2.4 KiB
Plaintext
54 lines
2.4 KiB
Plaintext
// RUN: %target-swift-frontend %s -Xllvm -sil-disable-pass=simplification -emit-ir | %FileCheck %s
|
|
|
|
// REQUIRES: CPU=x86_64
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
|
|
// This type has equal stride and size.
|
|
struct SameSizeStride { var x, y: Builtin.Int32 }
|
|
|
|
// This type has unequal stride and size.
|
|
struct DifferentSizeStride { var x: Builtin.Int32, y: Builtin.Int16 }
|
|
|
|
// CHECK: define{{( protected)?}} {{.*}}void @same_size_stride(ptr noalias {{(nocapture|captures\(none\))}} dereferenceable({{.*}}) %0, i64 %1) {{.*}} {
|
|
// CHECK: getelementptr inbounds %T8indexing14SameSizeStrideV, ptr %0, i64 %1
|
|
sil @same_size_stride : $@convention(thin) (@in SameSizeStride, Builtin.Word) -> () {
|
|
entry(%p : $*SameSizeStride, %i: $Builtin.Word):
|
|
%q = index_addr %p : $*SameSizeStride, %i : $Builtin.Word
|
|
return undef : $()
|
|
}
|
|
|
|
// CHECK: define{{( protected)?}} {{.*}}void @different_size_stride(ptr noalias {{(nocapture|captures\(none\))}} dereferenceable({{.*}}) %0, i64 %1) {{.*}} {
|
|
// CHECK: %2 = mul nsw i64 %1, 8
|
|
// CHECK-NEXT: %3 = getelementptr inbounds i8, ptr %0, i64 %2
|
|
sil @different_size_stride : $@convention(thin) (@in DifferentSizeStride, Builtin.Word) -> () {
|
|
entry(%p : $*DifferentSizeStride, %i: $Builtin.Word):
|
|
%q = index_addr %p : $*DifferentSizeStride, %i : $Builtin.Word
|
|
return undef : $()
|
|
}
|
|
|
|
// CHECK: define{{( protected)?}} {{.*}}void @zero_size(ptr noalias {{(nocapture|captures\(none\))}} %0, i64 %1) {{.*}} {
|
|
// CHECK: %2 = mul nsw i64 %1, 1
|
|
// CHECK-NEXT: %3 = getelementptr inbounds i8, ptr %0, i64 %2
|
|
sil @zero_size : $@convention(thin) (@in (), Builtin.Word) -> () {
|
|
entry(%p : $*(), %i: $Builtin.Word):
|
|
%q = index_addr %p : $*(), %i : $Builtin.Word
|
|
return undef : $()
|
|
}
|
|
|
|
// CHECK: define{{( protected)?}} {{.*}}void @dynamic_size(ptr noalias %0, i64 %1, ptr %T) {{.*}} {
|
|
// CHECK: [[T1:%.*]] = getelementptr inbounds ptr, ptr %T, i64 -1
|
|
// CHECK-NEXT: [[VWT:%T.valueWitnesses]] = load ptr, ptr [[T1]], align 8
|
|
// CHECK: [[STRIDE_ADDR:%.*]] = getelementptr inbounds{{.*}} %swift.vwtable, ptr [[VWT]], i32 0, i32 9
|
|
// CHECK: [[STRIDE:%.*]] = load i64, ptr [[STRIDE_ADDR]]
|
|
// CHECK-NEXT: [[T0:%.*]] = mul nsw i64 %1, [[STRIDE]]
|
|
// CHECK-NEXT: getelementptr inbounds i8, ptr %0, i64 [[T0]]
|
|
|
|
sil @dynamic_size : $@convention(thin) <T> (@in T, Builtin.Word) -> () {
|
|
entry(%p : $*T, %i: $Builtin.Word):
|
|
%q = index_addr %p : $*T, %i : $Builtin.Word
|
|
return undef : $()
|
|
}
|