Files
swift-mirror/test/SILOptimizer/set.swift
Erik Eckstein 3243f87204 tests: remove the lit feature swift_in_compiler
Tests require the compiler built with SwiftCompilerSources since a long time.
So this lit feature was redundant anyway. We can remove it.
2026-06-30 14:47:56 +02:00

32 lines
1.4 KiB
Swift

// RUN: %target-swift-frontend -parse-as-library -primary-file %s -O -sil-verify-all -module-name=test -Xllvm -sil-disable-pass=function-signature-opts -emit-sil | %FileCheck %s
// RUN: %target-swift-frontend -parse-as-library -primary-file %s -Osize -sil-verify-all -module-name=test -Xllvm -sil-disable-pass=function-signature-opts -emit-sil | %FileCheck %s
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
// Test optimal code generation for creating empty sets.
// CHECK-LABEL: sil {{.*}}@$s4test30createEmptySetFromArrayLiteralShySiGyF
// CHECK: global_addr @_swiftEmptySetSingleton
// CHECK-NOT: apply
// CHECK: } // end sil function '$s4test30createEmptySetFromArrayLiteralShySiGyF'
public func createEmptySetFromArrayLiteral() -> Set<Int> {
return []
}
// CHECK-LABEL: sil {{.*}}@$s4test29createEmptySetWithInitializerShySiGyF
// CHECK: global_addr @_swiftEmptySetSingleton
// CHECK-NOT: apply
// CHECK: } // end sil function '$s4test29createEmptySetWithInitializerShySiGyF'
public func createEmptySetWithInitializer() -> Set<Int> {
return Set<Int>()
}
// CHECK-LABEL: sil {{.*}}@$s4test17createNonEmptySetShySiGyF
// CHECK: global_value
// CHECK: [[F:%[0-9]+]] = function_ref @$sSh21_nonEmptyArrayLiteralShyxGSayxG_tcfCSi_Tt0g5
// CHECK: apply [[F]]
// CHECK: } // end sil function '$s4test17createNonEmptySetShySiGyF'
public func createNonEmptySet() -> Set<Int> {
return [1, 2, 3]
}