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.
66 lines
3.2 KiB
Swift
66 lines
3.2 KiB
Swift
// RUN: %target-swift-emit-silgen -Xllvm -sil-print-types -enable-copy-propagation=requested-passes-only -module-name moveonly -parse-stdlib %s -disable-access-control -disable-objc-attr-requires-foundation-module | %FileCheck %s
|
|
// RUN: %target-swift-emit-sil -Xllvm -sil-print-types -enable-copy-propagation=requested-passes-only -module-name moveonly -parse-stdlib %s -disable-access-control -disable-objc-attr-requires-foundation-module | %FileCheck -check-prefix=CHECK-SIL %s
|
|
// RUN: %target-swift-emit-sil -Xllvm -sil-print-types -enable-copy-propagation=requested-passes-only -module-name moveonly -parse-stdlib %s -disable-access-control -disable-objc-attr-requires-foundation-module -O -Xllvm -sil-disable-pass=FunctionSignatureOpts | %FileCheck -check-prefix=CHECK-SIL-OPT %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
import Swift
|
|
|
|
class Klass {}
|
|
|
|
// CHECK-LABEL: sil [ossa] @$s8moveonly7useCopyyAA5KlassCADF : {{.*}} {
|
|
// CHECK: bb0([[ARG:%.*]] :
|
|
// CHECK-NEXT: debug_value
|
|
// CHECK-NEXT: [[COPY:%[^,]+]] = copy_value [[ARG]]
|
|
// CHECK-NEXT: [[EXPLICIT_COPY:%[^,]+]] = explicit_copy_value [[COPY]]
|
|
// CHECK-NEXT: destroy_value [[COPY]]
|
|
// CHECK-NEXT: return [[EXPLICIT_COPY]]
|
|
// CHECK-LABEL: } // end sil function '$s8moveonly7useCopyyAA5KlassCADF'
|
|
|
|
// CHECK-SIL-LABEL: sil @$s8moveonly7useCopyyAA5KlassCADF : {{.*}} {
|
|
// CHECK-SIL: bb0([[ARG:%.*]] : $Klass):
|
|
// CHECK-SIL-NEXT: debug_value
|
|
// CHECK-SIL-NEXT: strong_retain [[ARG]]
|
|
// CHECK-SIL-NEXT: strong_retain [[ARG]]
|
|
// CHECK-SIL-NEXT: strong_release [[ARG]]
|
|
// CHECK-SIL-NEXT: return [[ARG]] : $Klass
|
|
// CHECK-SIL-LABEL: } // end sil function '$s8moveonly7useCopyyAA5KlassCADF'
|
|
|
|
// CHECK-SIL-OPT-LABEL: sil {{.*}}@$s8moveonly7useCopyyAA5KlassCADF : {{.*}} {
|
|
// CHECK-SIL-OPT: bb0([[ARG:%.*]] : $Klass):
|
|
// CHECK-SIL-OPT-NEXT: debug_value
|
|
// CHECK-SIL-OPT-NEXT: strong_retain [[ARG]]
|
|
// CHECK-SIL-OPT-NEXT: return [[ARG]]
|
|
// CHECK-SIL-OPT-LABEL: } // end sil function '$s8moveonly7useCopyyAA5KlassCADF'
|
|
public func useCopy(_ k: Klass) -> Klass {
|
|
copy k
|
|
}
|
|
|
|
// CHECK-LABEL: sil [ossa] @$s8moveonly7useCopyyxxRlzClF : $@convention(thin) <T where T : AnyObject> (@guaranteed T) -> @owned T {
|
|
// CHECK: bb0([[ARG:%.*]] :
|
|
// CHECK-NEXT: debug_value
|
|
// CHECK-NEXT: [[COPY:%[^,]+]] = copy_value [[ARG]]
|
|
// CHECK-NEXT: [[EXPLICIT_COPY:%[^,]+]] = explicit_copy_value [[COPY]]
|
|
// CHECK-NEXT: destroy_value [[COPY]]
|
|
// CHECK-NEXT: return [[EXPLICIT_COPY]]
|
|
// CHECK-LABEL: } // end sil function '$s8moveonly7useCopyyxxRlzClF'
|
|
|
|
// CHECK-SIL-LABEL: sil @$s8moveonly7useCopyyxxRlzClF : {{.*}} {
|
|
// CHECK-SIL: bb0([[ARG:%.*]] :
|
|
// CHECK-SIL-NEXT: debug_value
|
|
// CHECK-SIL-NEXT: strong_retain [[ARG]]
|
|
// CHECK-SIL-NEXT: strong_retain [[ARG]]
|
|
// CHECK-SIL-NEXT: strong_release [[ARG]]
|
|
// CHECK-SIL-NEXT: return [[ARG]]
|
|
// CHECK-SIL-LABEL: } // end sil function '$s8moveonly7useCopyyxxRlzClF'
|
|
|
|
// CHECK-SIL-OPT-LABEL: sil {{.*}}@$s8moveonly7useCopyyxxRlzClF : {{.*}} {
|
|
// CHECK-SIL-OPT: bb0([[ARG:%.*]] :
|
|
// CHECK-SIL-OPT-NEXT: debug_value
|
|
// CHECK-SIL-OPT-NEXT: strong_retain [[ARG]]
|
|
// CHECK-SIL-OPT-NEXT: return [[ARG]] : $T
|
|
// CHECK-SIL-OPT-LABEL: } // end sil function '$s8moveonly7useCopyyxxRlzClF'
|
|
public func useCopy<T : AnyObject>(_ k: T) -> T {
|
|
copy k
|
|
}
|