Files
swift-mirror/test/IRGen/fixed_size_buffer_peepholes.sil
Anthony Latsis 17fc00f8a7 [test] IRGen: Adjust FileCheck patterns for new nuw attribute in upstream LLVM
This attribute was introduced in
7eca38ce76d5d1915f4ab7e665964062c0b37697 (llvm-project).

Match it using a wildcard regex, since it is not relevant to these
tests.

This is intended to reduce future conflicts with rebranch.
2025-05-04 03:28:56 +01:00

30 lines
1.5 KiB
Plaintext

// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu
import Builtin
protocol P {}
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @dont_crash(
// CHECK: [[TYPE_ADDR:%.*]] = getelementptr inbounds{{.*}} %T27fixed_size_buffer_peepholes1PP, ptr %0, i32 0, i32 1
// CHECK: [[TYPE:%.*]] = load ptr, ptr [[TYPE_ADDR]]
// CHECK: call {{.*}} @__swift_project_boxed_opaque_existential_1
// CHECK: [[VWT_ADDR:%.*]] = getelementptr inbounds ptr, ptr [[TYPE]], {{(i64|i32)}} -1
// CHECK: [[VWT:%.*]] = load ptr, ptr [[VWT_ADDR]]
// CHECK-arm64e-NEXT: ptrtoint ptr [[VWT_ADDR]] to i64
// CHECK-arm64e-NEXT: call i64 @llvm.ptrauth.blend
// CHECK-arm64e: [[VWT:%.*]] = inttoptr i64 {{%.*}} to ptr
// CHECK: [[WITNESS_ADDR:%.*]] = getelementptr inbounds ptr, ptr [[VWT]], {{(i64|i32)}} 2
// CHECK: [[WITNESS:%.*]] = load ptr, ptr [[WITNESS_ADDR]]
// CHECK: call ptr [[WITNESS]](
sil @dont_crash : $@convention(thin) (@in P) -> () {
entry(%p : $*P):
%0 = alloc_stack $P
%1 = open_existential_addr immutable_access %p : $*P to $*@opened("4E4E7668-C798-11E6-9B9F-685B3589058E", P) Self
%2 = init_existential_addr %0 : $*P, $@opened("4E4E7668-C798-11E6-9B9F-685B3589058E", P) Self
copy_addr %1 to [init] %2 : $*@opened("4E4E7668-C798-11E6-9B9F-685B3589058E", P) Self
destroy_addr %2 : $*@opened("4E4E7668-C798-11E6-9B9F-685B3589058E", P) Self
deinit_existential_addr %0 : $*P
dealloc_stack %0 : $*P
return undef: $()
}