mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
I am going to be using in inst-simplify/sil-combine/canonicalize instruction a RAUW everything against everything API (*). This creates some extra ARC traffic/borrows. It is going to be useful to have some simple peepholes that gets rid of some of the extraneous traffic. (*) Noting that we are not going to support replacing non-trivial OwnershipKind::None values with non-trivial OwnershipKind::* values. This is a corner case that only comes up with non-trivial enums that have a non-payloaded or trivial enum case. It is much more complex to implement that transform, but it is an edge case, so we are just not going to support those for now. ---- I also eliminated the dependence of SILGenCleanup on Swift/SwiftShims. This speeds up iterating on the test case with a debug compiler since we don't need those modules.
24 lines
933 B
Swift
24 lines
933 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %build-clang-importer-objc-overlays
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -I \
|
|
// RUN: %S/../ClangImporter/Inputs/custom-modules -emit-sil -o /dev/null \
|
|
// RUN: -primary-file %s -Xllvm -sil-print-debuginfo -module-name patatino \
|
|
// RUN: -Onone -Xllvm -sil-print-after=diagnostic-constant-propagation \
|
|
// RUN: 2>&1 | %FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: OS=macosx
|
|
|
|
// Make sure that the destroy_addr instruction has the same scope of the
|
|
// instructions surrounding it.
|
|
|
|
// CHECK: destroy_addr %7 : $*Any, loc {{.*}}:22:19, scope 2
|
|
// CHECK: dealloc_stack %12 : $*Optional<Any>, loc {{.*}}:22:23, scope 2
|
|
// CHECK: dealloc_stack %7 : $*Any, loc {{.*}}:22:23, scope 2
|
|
// CHECK: dealloc_stack %6 : $*A, loc {{.*}}:22:7, scope 2
|
|
|
|
import Foundation
|
|
func indexedSubscripting(b b: B, idx: Int, a: A) {
|
|
var a2 = b[idx] as! A
|
|
}
|