IRGen: Fix some test cases for llvm rebranch

This commit is contained in:
Arnold Schwaighofer
2024-05-01 08:16:27 -07:00
parent a7d3834066
commit fdb050d2cf
16 changed files with 76 additions and 41 deletions

View File

@@ -3,11 +3,14 @@
// RUN: %target-swift-frontend -emit-module -emit-module-path=%t/other_class.swiftmodule %S/Inputs/other_class.swift
// RUN: %target-swift-frontend -I %t -emit-ir -O -enforce-exclusivity=unchecked %s | %FileCheck %s -DINT=i%target-ptrsize
// REQUIRES: PTRSIZE=64
import other_class
// CHECK-LABEL: define {{(protected )?}}{{(dllexport )?}}swiftcc i32 @"$s24class_field_other_module12getSubclassXys5Int32V0c1_A00F0CF"(ptr nocapture readonly %0)
// CHECK-NEXT: entry:
// CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds %T11other_class5OtherC, ptr %0, [[INT]] 0, i32 1
// An Int32 after the heap object header
// CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr %0, i64 16
// CHECK-NEXT: [[RESULT:%.*]] = load i32, ptr [[GEP]]
// CHECK-NEXT: ret i32 [[RESULT]]
public func getSubclassX(_ o: Subclass) -> Int32 {
@@ -16,7 +19,8 @@ public func getSubclassX(_ o: Subclass) -> Int32 {
// CHECK-LABEL: define {{(protected )?}}{{(dllexport )?}}swiftcc i32 @"$s24class_field_other_module12getSubclassYys5Int32V0c1_A00F0CF"(ptr nocapture readonly %0)
// CHECK-NEXT: entry:
// CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds %T11other_class8SubclassC, ptr %0, [[INT]] 0, i32 2
// An Int32 after an Int32 after the heap object header
// CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i8, ptr %0, i64 20
// CHECK-NEXT: [[RESULT:%.*]] = load i32, ptr [[GEP]]
// CHECK-NEXT: ret i32 [[RESULT]]
public func getSubclassY(_ o: Subclass) -> Int32 {

View File

@@ -1,5 +1,7 @@
// REQUIRES: differentiable_programming
// XFAIL: *
// RUN: %empty-directory(%t)
// RUN: %target-swiftc_driver -DM -emit-module -emit-module-path %t/M.swiftmodule %s -module-name M
// RUN: %target-swiftc_driver -O -g -I %t -c %s -emit-ir -o - | %FileCheck %s

View File

@@ -37,7 +37,7 @@ open class d {
// CHECK-DAG: define dllexport swiftcc ptr @"$s9dllexport1cCfd"(ptr{{.*}})
// CHECK-DAG-NO-OPT: define dllexport swiftcc ptr @"$s9dllexport1cCACycfc"(ptr %0)
// CHECK-DAG-NO-OPT: define dllexport swiftcc ptr @"$s9dllexport1cCACycfC"(ptr %0)
// CHECK-DAG: define dllexport swiftcc {{(nonnull )?}}ptr @"$s9dllexport2ciAA1cCvau"()
// CHECK-DAG: define dllexport swiftcc {{(noundef )?(nonnull )?}}ptr @"$s9dllexport2ciAA1cCvau"()
// CHECK-DAG-NO-OPT: define dllexport swiftcc void @"$s9dllexport1dC1m33_C57BA610BA35E21738CC992438E660E9LLyyF"(ptr %0)
// CHECK-DAG-NO-OPT: define dllexport swiftcc void @"$s9dllexport1dCfD"(ptr %0)
// CHECK-DAG: define dllexport swiftcc ptr @"$s9dllexport1dCfd"(ptr{{.*}})

View File

@@ -41,7 +41,7 @@ public enum SingletonEnum {
// CHECK-OPT: ret void
// CHECK: }
// CHECK: define internal i32 @"$s14enum_singleton13SingletonEnumOwug"
// CHECK: define internal{{.*}} i32 @"$s14enum_singleton13SingletonEnumOwug"
// CHECK: ret i32 0
// CHECK: }

View File

@@ -55,11 +55,13 @@ public func testGlobalFunctions() {
// --- funcWithOpaqueResult() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper20funcWithOpaqueResultQryFTwS"()
// CHECK: ret i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper20funcWithOpaqueResultQryFQOMQ", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper20funcWithOpaqueResultQryF", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper20funcWithOpaqueResultQryFQOMQ", ptr null), icmp ne (ptr @"$s17has_symbol_helper20funcWithOpaqueResultQryF", ptr null)
// CHECK: ret i1 %0
// --- cdeclFunc() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper9cdeclFuncyyFTwS"()
// CHECK: ret i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper9cdeclFuncyyF", ptr null), i1 icmp ne (ptr @cdecl_func, ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper9cdeclFuncyyF", ptr null), icmp ne (ptr @cdecl_func, ptr null)
// CHECK: ret i1 %0
// --- forwardDeclaredFunc() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper19forwardDeclaredFuncyyFTwS"()
@@ -67,19 +69,33 @@ public func testGlobalFunctions() {
// --- dynamicFunc() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper11dynamicFuncyyFTwS"()
// CHECK: ret i1 and (i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper11dynamicFuncyyF", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper11dynamicFuncyyFTX", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper11dynamicFuncyyFTx", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper11dynamicFuncyyF", ptr null), icmp ne (ptr @"$s17has_symbol_helper11dynamicFuncyyFTX", ptr null)
// CHECK: %1 = and i1 %0, icmp ne (ptr @"$s17has_symbol_helper11dynamicFuncyyFTx", ptr null)
// CHECK: ret i1 %1
// --- replacementFunc() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper15replacementFuncyyFTwS"()
// CHECK: ret i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper15replacementFuncyyF", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper15replacementFuncyyFTX", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper15replacementFuncyyF", ptr null), icmp ne (ptr @"$s17has_symbol_helper15replacementFuncyyFTX", ptr null)
// CHECK: ret i1 %0
// --- dynamicFuncOpaqueResult() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFTwS"()
// CHECK: ret i1 and (i1 and (i1 and (i1 and (i1 and (i1 and (i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMQ", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMg", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMh", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMg", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMg", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryF", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFTX", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFTx", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMQ", ptr null), icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMg", ptr null)
// CHECK: %1 = and i1 %0, icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMh", ptr null)
// CHECK: %2 = and i1 %1, icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMg", ptr null)
// CHECK: %3 = and i1 %2, icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFQOMg", ptr null)
// CHECK: %4 = and i1 %3, icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryF", ptr null)
// CHECK: %5 = and i1 %4, icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFTX", ptr null)
// CHECK: %6 = and i1 %5, icmp ne (ptr @"$s17has_symbol_helper23dynamicFuncOpaqueResultQryFTx", ptr null)
// CHECK: ret i1 %6
// --- replacementFuncOpaqueResult() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFTwS"()
// CHECK: ret i1 and (i1 and (i1 and (i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFQOMQ", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFQOMg", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFQOMg", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryF", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFTX", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFQOMQ", ptr null), icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFQOMg", ptr null)
// CHECK: %1 = and i1 %0, icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFQOMg", ptr null)
// CHECK: %2 = and i1 %1, icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryF", ptr null)
// CHECK: %3 = and i1 %2, icmp ne (ptr @"$s17has_symbol_helper27replacementFuncOpaqueResultQryFTX", ptr null)
// CHECK: ret i1 %3
public func testVars() {
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper6globalSivpTwS"()
@@ -100,11 +116,13 @@ public func testClass(_ c: C) {
// --- C.init() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1CCACycfcTwS"()
// CHECK: ret i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper1CCACycfc", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper1CCACycfC", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper1CCACycfc", ptr null), icmp ne (ptr @"$s17has_symbol_helper1CCACycfC", ptr null)
// CHECK: ret i1 %0
// --- C.method(with:) ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1CC6method4withySi_tFTwS"()
// CHECK: ret i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper1CC6method4withySi_tFTj", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper1CC6method4withySi_tFTq", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper1CC6method4withySi_tFTj", ptr null), icmp ne (ptr @"$s17has_symbol_helper1CC6method4withySi_tFTq", ptr null)
// CHECK: ret i1 %0
public func testStruct(_ s: S) {
// CHECK: %{{[0-9]+}} = call i1 @"$s17has_symbol_helper1SV6memberSivpTwS"()
@@ -116,7 +134,10 @@ public func testStruct(_ s: S) {
// --- S.member ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SV6memberSivpTwS"()
// CHECK: ret i1 and (i1 and (i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivpMV", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivg", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivs", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivM", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivpMV", ptr null), icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivg", ptr null)
// CHECK: %1 = and i1 %0, icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivs", ptr null)
// CHECK: %2 = and i1 %1, icmp ne (ptr @"$s17has_symbol_helper1SV6memberSivM", ptr null)
// CHECK: ret i1 %2
// --- S.method(with:) ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SV6method4withySi_tFTwS"()
@@ -169,4 +190,6 @@ public func testMetatypes() {
// --- S.self ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1SVTwS"()
// CHECK: ret i1 and (i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper1SVMn", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper1SVN", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper1SVMa", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper1SVMn", ptr null), icmp ne (ptr @"$s17has_symbol_helper1SVN", ptr null)
// CHECK: %1 = and i1 %0, icmp ne (ptr @"$s17has_symbol_helper1SVMa", ptr null)
// CHECK: ret i1 %1

View File

@@ -17,7 +17,8 @@ public func testGlobalFunctions() {
// --- asyncFunc() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper9asyncFuncyyYaFTwS"()
// CHECK: ret i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper9asyncFuncyyYaF", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper9asyncFuncyyYaFTu", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper9asyncFuncyyYaF", ptr null), icmp ne (ptr @"$s17has_symbol_helper9asyncFuncyyYaFTu", ptr null)
// CHECK: ret i1 %0
// --- isolatedFunc() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper12isolatedFuncyyFTwS"()
@@ -35,8 +36,11 @@ public func testActor(_ a: A) {
// --- A.init() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1ACACycfcTwS"()
// CHECK: ret i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper1ACACycfc", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper1ACACycfC", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper1ACACycfc", ptr null), icmp ne (ptr @"$s17has_symbol_helper1ACACycfC", ptr null)
// CHECK: ret i1 %0
// --- A.asyncMethod() ---
// CHECK: define linkonce_odr hidden i1 @"$s17has_symbol_helper1AC11asyncMethodyyYaFTwS"()
// CHECK: ret i1 and (i1 and (i1 icmp ne (ptr @"$s17has_symbol_helper1AC11asyncMethodyyYaFTj", ptr null), i1 icmp ne (ptr @"$s17has_symbol_helper1AC11asyncMethodyyYaFTjTu", ptr null)), i1 icmp ne (ptr @"$s17has_symbol_helper1AC11asyncMethodyyYaFTq", ptr null))
// CHECK: %0 = and i1 icmp ne (ptr @"$s17has_symbol_helper1AC11asyncMethodyyYaFTj", ptr null), icmp ne (ptr @"$s17has_symbol_helper1AC11asyncMethodyyYaFTjTu", ptr null)
// CHECK: %1 = and i1 %0, icmp ne (ptr @"$s17has_symbol_helper1AC11asyncMethodyyYaFTq", ptr null)
// CHECK: ret i1 %1

View File

@@ -16,7 +16,7 @@
// CHECK: call void @pass_and_return(ptr {{.*}} [[CALL_ALLOCA]], ptr nonnull [[TMP_ALLOCA]], ptr nonnull [[TMP_ALLOCA2]])
// CHECK: call {{.*}} @swift_allocObject
// CHECK: [[BOX:%.*]] = call noalias ptr @swift_allocObject(
// CHECK: [[ADDR_IN_BOX:%.*]] = getelementptr inbounds <{ %swift.refcounted, [128 x i8] }>, ptr [[BOX]], i64 0, i32 1
// CHECK: [[ADDR_IN_BOX:%.*]] = getelementptr inbounds i8, ptr %8, i64 16
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}} [[ADDR_IN_BOX]], ptr {{.*}} [[CALL_ALLOCA]], i64 128, i1 false)
// CHECK: call void @llvm.lifetime.end.p0(i64 128, ptr nonnull [[CALL_ALLOCA]])
public func runTest(_ l : large_thing) {

View File

@@ -15,7 +15,7 @@
// CHECK: call void @pass_and_return(ptr {{.*}} [[CALL_ALLOCA]], ptr nonnull byval{{.*}} %0, ptr nonnull byval{{.*}} %0)
// CHECK: call {{.*}} @swift_allocObject
// CHECK: [[BOX:%.*]] = {{.*}}call noalias ptr @swift_allocObject(
// CHECK: [[ADDR_IN_BOX:%.*]] = getelementptr inbounds <{ %swift.refcounted, [128 x i8] }>, ptr [[BOX]], i64 0, i32 1
// CHECK: [[ADDR_IN_BOX:%.*]] = getelementptr inbounds i8, ptr [[BOX]], i64 16
// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}} [[ADDR_IN_BOX]], ptr {{.*}} [[CALL_ALLOCA]], i64 128, i1 false)
// CHECK: call void @llvm.lifetime.end.p0(i64 128, ptr nonnull [[CALL_ALLOCA]])
public func runTest(_ l : large_thing) {

View File

@@ -64,8 +64,8 @@ func create<T>(_ t: T) -> C<T> {
// Make sure we don't loose the stores for the optional UInt32? in optimize mode.
// OPT-LABEL: define hidden swiftcc void @"$s16non_fixed_return1CVACyxGycfC"(ptr noalias sret(%swift.opaque) %0
// OPT: store i32 0, ptr [[BASE:%[0-9]+]]
// OPT: [[ADDR2:%.*]] = getelementptr inbounds %Ts6UInt32VSg, ptr [[BASE]], i64 0, i32 1
// OPT: [[ADDR2:%.*]] = getelementptr inbounds i8, ptr [[BASE]], i64 4
// OPT: store i1 true, ptr [[ADDR2]]
// OPT: [[ADDR4:%.*]] = getelementptr inbounds %T16non_fixed_return1BV, ptr [[BASE]], i64 0, i32 2
// OPT: [[ADDR4:%.*]] = getelementptr inbounds i8, ptr [[BASE]], i64 8
// OPT: call void @llvm.memset.p0.i64(ptr {{.*}}[[ADDR4]], i8 0, i64 16, i1 false)
// OPT: ret void

View File

@@ -8,7 +8,7 @@
import Foundation
func foo() -> Int64 {
// CHECK-LABEL: define internal i64 @"$s10objc_local3foos5Int64VyF3BarL_C10returnFiveADyFTo"
// CHECK-LABEL: define internal{{( noundef)?}} i64 @"$s10objc_local3foos5Int64VyF3BarL_C10returnFiveADyFTo"
class Bar: NSObject {
@objc func returnFive() -> Int64 { return 6 }
}

View File

@@ -13,7 +13,7 @@ bb0(%arg : $Int):
return %res : $Int
}
// CHECK: define{{.*}} swiftcc [[T:i[0-9]+]] @rec([[T]] %0) #0 {
// CHECK: define{{.*}} swiftcc{{( noundef)?}} [[T:i[0-9]+]] @rec([[T]] %0) #0 {
// CHECK-NEXT: entry:
// CHECK-NEXT: br label %tailrecurse
// CHECK-EMPTY:

View File

@@ -49,12 +49,12 @@ crashCaller()
// VWT-macosx: store i64 [[VAL1]]
// VWT-macosx: [[T1:%.*]] = tail call swiftcc %swift.metadata_response @"$s16resilient_struct13ResilientBoolVMa"(i64 0)
// VWT-macosx: [[T2:%.*]] = extractvalue %swift.metadata_response [[T1]], 0
// VWT-macosx: [[T3:%.*]] = getelementptr inbounds ptr, ptr [[T2]], i64 -1
// VWT-macosx: [[T3:%.*]] = getelementptr inbounds i8, ptr [[T2]], i64 -8
// VWT-macosx: [[T5:%.*]] = load ptr, ptr [[T3]]
// VWT-macosx: [[T6:%.*]] = getelementptr inbounds ptr, ptr [[T5]], i64 5
// VWT-macosx: [[T6:%.*]] = getelementptr inbounds i8, ptr [[T5]], i64 4
// VWT-macosx: [[T8:%.*]] = load ptr, ptr [[T6]]
// VWT-macosx: tail call ptr [[T8]](
// VWT-macosx: [[F01:%.*]] = getelementptr inbounds i32, ptr [[MT]], i64 6
// VWT-macosx: [[F01:%.*]] = getelementptr inbounds i8, ptr [[MT]], i64 24
// VWT-macosx: [[F03:%.*]] = load i32, ptr [[F01]], align 8
// VWT-macosx: [[F04:%.*]] = sext i32 [[F03]] to i64
// VWT-macosx: [[FA1:%.*]] = getelementptr inbounds i8, ptr {{.*}}, i64 [[F04]]

View File

@@ -2,6 +2,8 @@
// RUN: %target-swift-frontend -enable-type-layout -primary-file %s -O -emit-ir | %FileCheck %s --check-prefix=OPT --check-prefix=OPT-%target-ptrsize
// RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s --check-prefix=NOTL
// REQUIRES: PTRSIZE=64
public struct B<T> {
var x: T
var y: T
@@ -80,20 +82,20 @@ public enum ForwardEnum<T> {
// OPT: define{{.*}} void @"$s30typelayout_based_value_witness1AVwxx"(ptr noalias %object, ptr nocapture readonly %"A<T>")
// OPT: [[T_PARAM:%.*]] = getelementptr inbounds ptr, ptr %"A<T>", {{(i64|i32)}} 2
// OPT: [[T_PARAM:%.*]] = getelementptr inbounds i8, ptr %"A<T>", i64 16
// OPT: [[T:%.*]] = load ptr, ptr [[T_PARAM]]
// OPT: [[VWT_ADDR:%.*]] = getelementptr inbounds ptr, ptr [[T]], {{(i64|i32)}} -1
// OPT: [[VWT_ADDR:%.*]] = getelementptr inbounds i8, ptr [[T]], {{(i64|i32)}} -8
// OPT: [[VWT:%.*]] = load ptr, ptr [[VWT_ADDR]]
// OPT: [[DESTROY_VW:%.*]] = getelementptr inbounds ptr, ptr [[VWT]], {{(i64|i32)}} 1
// OPT: [[DESTROY_VW:%.*]] = getelementptr inbounds i8, ptr [[VWT]], {{(i64|i32)}} 8
// OPT: [[DESTROY:%.*]] = load ptr, ptr [[DESTROY_VW]]
// OPT: tail call void [[DESTROY]](ptr noalias %object, ptr [[T]])
// OPT: [[SIZE_VW:%.*]] = getelementptr inbounds %swift.vwtable, ptr [[VWT]], {{i64|i32}} 0, {{(i64|i32)}} 8
// OPT: [[SIZE_VW:%.*]] = getelementptr inbounds i8, ptr [[VWT]], {{(i64|i32)}} 64
// OPT: [[SIZE_T:%.*]] = load {{(i64|i32)}}, ptr [[SIZE_VW]]
// OPT: [[OBJECT:%.*]] = ptrtoint ptr %object to {{(i64|i32)}}
// OPT: [[FLAGS_VW:%.*]] = getelementptr inbounds {{.*}}, ptr [[VWT]], {{i64|i32}} 0, {{(i64|i32)}} 10
// OPT: [[FLAGS_VW:%.*]] = getelementptr inbounds i8, ptr [[VWT]], {{(i64|i32)}} 80
// OPT: [[FLAGS3:%.*]] = load i32, ptr [[FLAGS_VW]]
// OPT: [[FLAGS:%.*]] = and i32 [[FLAGS3]], 255
// OPT-64: %flags.alignmentMask = zext i32 [[FLAGS]] to i64
// OPT-64: %flags.alignmentMask = zext nneg i32 [[FLAGS]] to i64
// OPT-64: [[TMP:%.*]] = add {{(i64|i32)}} [[SIZE_T]], %flags.alignmentMask
// OPT-32: [[TMP:%.*]] = add {{(i64|i32)}} %flags.alignmentMask, [[SIZE_T]]
// OPT: [[TMP2:%.*]] = add {{(i64|i32)}} [[TMP]], [[OBJECT]]

View File

@@ -126,13 +126,13 @@ sil @associatedtype_with_added_conformance_2_callee : $<each T : R> () -> () {}
// CHECK-SAME: ptr %"each T",
// CHECK-SAME: ptr %"each T.Q")
// CHECK: [[GEN2_TYPES:%[^,]+]] = alloca ptr, [[INT]] [[SHAPE]]
// CHECK: [[STORED_STACK_LOC:%[^,]+]] = call ptr @llvm.stacksave()
// CHECK: [[STORED_STACK_LOC:%[^,]+]] = call ptr @llvm.stacksave.p0()
// CHECK: [[GEN2_CONFORMANCES_TO_Q:%[^,]+]] = alloca ptr, [[INT]] [[SHAPE]]
// CHECK: call swiftcc void @associatedtype_with_forwarded_conformance_1_callee(
// CHECK-SAME: [[INT]] [[SHAPE]],
// CHECK-SAME: ptr [[GEN2_TYPES]],
// CHECK-SAME: ptr [[GEN2_CONFORMANCES_TO_Q]])
// CHECK: call void @llvm.stackrestore(ptr [[STORED_STACK_LOC]])
// CHECK: call void @llvm.stackrestore.p0(ptr [[STORED_STACK_LOC]])
sil @associatedtype_with_forwarded_conformance_1 : $<each T : Q> () -> () {
%i = function_ref @associatedtype_with_forwarded_conformance_1_callee : $@convention(thin) <each T : Q> () -> ()
apply %i<Pack{repeat Gen2<each T>}>() : $@convention(thin) <each T : Q> () -> ()
@@ -149,14 +149,14 @@ sil @associatedtype_with_forwarded_conformance_1_callee : $<each T : Q> () -> ()
// CHECK-SAME: ptr %"each T.PA",
// CHECK-SAME: ptr %"(each T).A.Q")
// CHECK: [[GEN1_TYPES:%[^,]+]] = alloca ptr, [[INT]] [[SHAPE]]
// CHECK: [[STORED_STACK_LOC:%[^,]+]] = call ptr @llvm.stacksave()
// CHECK: [[STORED_STACK_LOC:%[^,]+]] = call ptr @llvm.stacksave.p0()
// CHECK: [[GEN1_CONFORMANCES_TO_PA:%[^,]+]] = alloca ptr, [[INT]] [[SHAPE]]
// CHECK: call swiftcc void @generictype_with_forwarded_conformance_2_callee(
// CHECK-SAME: [[INT]] [[SHAPE]],
// CHECK-SAME: ptr [[GEN1_TYPES]],
// CHECK-SAME: ptr [[GEN1_CONFORMANCES_TO_PA]],
// CHECK-SAME: ptr %"(each T).A.Q")
// CHECK: call void @llvm.stackrestore(ptr [[STORED_STACK_LOC]])
// CHECK: call void @llvm.stackrestore.p0(ptr [[STORED_STACK_LOC]])
sil @generictype_with_forwarded_conformance_2 : $<each T : PA where repeat (each T).A : Q>() -> () {
%callee = function_ref @generictype_with_forwarded_conformance_2_callee : $@convention(thin) <each T : PA where repeat (each T).A : Q> () -> ()
apply %callee<Pack{repeat Gen1<each T>}>() : $@convention(thin) <each T : PA where repeat (each T).A : Q> () -> ()
@@ -172,14 +172,14 @@ sil @generictype_with_forwarded_conformance_2_callee : $<each T : PA where repea
// CHECK-SAME: ptr %"each T.PA",
// CHECK-SAME: ptr %"(each T).A.Q")
// CHECK: [[GEN1_GEN1_TYPES:%[^,]+]] = alloca ptr, [[INT]] [[SHAPE]]
// CHECK: [[STORED_STACK_LOC:%[^,]+]] = call ptr @llvm.stacksave()
// CHECK: [[STORED_STACK_LOC:%[^,]+]] = call ptr @llvm.stacksave.p0()
// CHECK: [[GEN1_GEN1_CONFORMANCES_TO_PA:%[^,]+]] = alloca ptr, [[INT]] [[SHAPE]]
// CHECK: call swiftcc void @generic_with_forwarded_conformance_3_callee(
// CHECK-SAME: [[INT]] [[SHAPE]],
// CHECK-SAME: ptr [[GEN1_GEN1_TYPES]],
// CHECK-SAME: ptr [[GEN1_GEN1_CONFORMANCES_TO_PA]],
// CHECK-SAME: ptr %"(each T).A.Q")
// CHECK: call void @llvm.stackrestore(ptr [[STORED_STACK_LOC]])
// CHECK: call void @llvm.stackrestore.p0(ptr [[STORED_STACK_LOC]])
sil @generic_with_forwarded_conformance_3 : $<each T : PA where repeat (each T).A : Q> () -> () {
%callee = function_ref @generic_with_forwarded_conformance_3_callee : $@convention(thin) <each T : PA where repeat (each T).A : Q> () -> ()
apply %callee<Pack{repeat Gen1<Gen1<each T>>}>() : $@convention(thin) <each T : PA where repeat (each T).A : Q> () -> ()

View File

@@ -105,9 +105,9 @@ bb0(%pack : $*Pack{Int, repeat each T, Int}, %value : $Int):
// CHECK-LABEL: define {{.*}}@test_pack_alloc_1_dynamic(
// CHECK-SAME: [[INT]] [[PACK_SIZE:%[^,]+]]
// CHECK: [[SIZE:%[^,]+]] = add [[INT]] [[PACK_SIZE]], [[PACK_SIZE]]
// CHECK: [[SP_SAVE:%[^,]+]] = call ptr @llvm.stacksave()
// CHECK: [[SP_SAVE:%[^,]+]] = call ptr @llvm.stacksave.p0()
// CHECK: alloca ptr, [[INT]] [[SIZE]]
// CHECK: call void @llvm.stackrestore(ptr [[SP_SAVE]])
// CHECK: call void @llvm.stackrestore.p0(ptr [[SP_SAVE]])
sil @test_pack_alloc_1_dynamic : $<each T> () -> () {
// Control flow so that stack saving/restoring is emitted
entry:

View File

@@ -1,6 +1,6 @@
// RUN: %target-swift-frontend -O -primary-file %s -disable-availability-checking -emit-ir | %FileCheck %s
// CHECK: define{{( dllexport)?}}{{( protected)?}} i32 @main{{.*}} {
// CHECK: define{{( dllexport)?}}{{( protected)?}}{{( noundef)?}} i32 @main{{.*}} {
// CHECK: store ptr %{{[0-9]+}}, ptr @"$s13rdar1140137091xQrvp"
actor Actor {}
let x: some Actor = Actor()