mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
33 lines
1.9 KiB
Swift
33 lines
1.9 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-module -disable-availability-checking -o %t -enable-library-evolution -module-name ResilientLibrary %S/Inputs/opaque_values_silgen_resilient.swift
|
|
// RUN: %target-swift-frontend -enable-sil-opaque-values -Xllvm -sil-print-types -emit-silgen -disable-availability-checking -I %t %s | %FileCheck %s
|
|
|
|
import ResilientLibrary
|
|
|
|
// Verify that an enum instruction producing a trivial is _still_ destroyed if
|
|
// (1) the enum instruction's type is non-trivial
|
|
// (2) the enum is address-only
|
|
// Necessary because such an enum will be lowered to
|
|
// init_enum_data_addr/inject_enum_addr and there isn't generally enough
|
|
// information to determine whether a destroy_addr is required so it is always
|
|
// required.
|
|
// CHECK-LABEL: sil [ossa] @produceSomeEmptyNontrivialAddronlyEnumInstance : {{.*}} {
|
|
// CHECK: [[EMPTY_CASE:%[^,]+]] = enum $EnumNontrivialWithEmptyCases, #EnumNontrivialWithEmptyCases.empty!enumelt
|
|
// CHECK: [[SOME_EMPTY_CASE:%[^,]+]] = enum $Optional<EnumNontrivialWithEmptyCases>, #Optional.some!enumelt, [[EMPTY_CASE]]
|
|
// CHECK: destroy_value [[SOME_EMPTY_CASE]]
|
|
// CHECK-LABEL: } // end sil function 'produceSomeEmptyNontrivialAddronlyEnumInstance'
|
|
@_silgen_name("produceSomeEmptyNontrivialAddronlyEnumInstance")
|
|
public func produceSomeEmptyNontrivialAddronlyEnumInstance(_ one: EnumNontrivialWithEmptyCases?) {
|
|
if one != .empty {
|
|
}
|
|
}
|
|
|
|
// CHECK-LABEL: sil [ossa] @produceNoneEmptyAddronlyEnumInstance : {{.*}} {
|
|
// CHECK: [[NONE:%[^,]+]] = enum $Optional<EnumNontrivialWithEmptyCases>, #Optional.none!enumelt
|
|
// CHECK: return [[NONE]] : $Optional<EnumNontrivialWithEmptyCases>
|
|
// CHECK-LABEL: } // end sil function 'produceNoneEmptyAddronlyEnumInstance'
|
|
@_silgen_name("produceNoneEmptyAddronlyEnumInstance")
|
|
public func produceNoneEmptyAddronlyEnumInstance() -> EnumNontrivialWithEmptyCases? {
|
|
return .none
|
|
}
|