Update various tests for enabling mandatory copy propagation.

This commit is contained in:
Andrew Trick
2021-03-05 05:11:01 -08:00
parent 8839ca0a4e
commit 0aba7b6373
12 changed files with 49 additions and 16 deletions

View File

@@ -42,7 +42,7 @@ var lens = Lens(Rectangle(topLeft: topLeft,
// CHECK: function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs15WritableKeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply %45<Rectangle, Point>({{.*}})
// CHECK: function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs7KeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply %54<Point, Int>({{.*}})
// CHECK-NEXT: apply %{{.*}}<Point, Int>({{.*}})
_ = lens.topLeft.x
// CHECK: function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs15WritableKeyPathCyxqd__G_tcluig

View File

@@ -3,7 +3,7 @@ class C {
func withClosure(_ : () -> ()) -> () {}
func f() {
// CHECK: define{{.*}}$s11capturelist1CC1fyyFyyXEfU_
// CHECK-LABEL: define{{.*}}$s11capturelist1CC1fyyFyyXEfU_
// There should not be a local weak variable "self" shadowing the
// implicit self argument.
// let self
@@ -12,7 +12,7 @@ class C {
// CHECK: call void @llvm.dbg
// var weak self
// CHECK-NOT: call void @llvm.dbg
// CHECK: ret void
// CHECK-LABEL: ret void
withClosure { [weak self] in
guard let s = self else { return }
}

View File

@@ -1,4 +1,5 @@
// RUN: %target-swift-frontend %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck %s
// RUN: %target-swift-frontend %s -emit-sil -disable-copy-propagation -emit-verbose-sil -g -o - | %FileCheck %s --check-prefixes=CHECK,CHECK-NCP
// RUN: %target-swift-frontend %s -emit-sil -enable-copy-propagation -emit-verbose-sil -g -o - | %FileCheck %s --check-prefixes=CHECK,CHECK-CP
class NSURL {}
@@ -26,14 +27,15 @@ class AppDelegate {
// Verify that the branch's location is >= the cleanup's location.
// (The implicit false block of the conditional
// below inherits the location from the condition.)
// CHECK-CP: destroy_value [poison] {{.*}}$NSPathControlItem{{.*}}line:[[@LINE+2]]
// CHECK: br{{.*}}line:[[@LINE+1]]
if let url = item.URL
{
LogStr( "There is a url" )
}
// Verify that the branch's location is >= the cleanup's location.
// CHECK: strong_release{{.*}}$NSPathControlItem{{.*}}line:[[@LINE+2]]
// CHECK-NEXT: br{{.*}}line:[[@LINE+1]]
// CHECK-NCP: strong_release{{.*}}$NSPathControlItem{{.*}}line:[[@LINE+2]]
// CHECK: br{{.*}}line:[[@LINE+1]]
}
}
}

View File

@@ -1,5 +1,6 @@
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-ir -g -o - | %FileCheck %s
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck -check-prefix=CHECK-SIL %s
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -disable-copy-propagation %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck --check-prefixes=CHECK-SIL,CHECK-NCP %s
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -enable-copy-propagation %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck --check-prefixes=CHECK-SIL,CHECK-CP %s
import StdlibUnittest
class Obj {}
@@ -16,9 +17,10 @@ func testDoStmt() throws -> Void {
do {
let obj = Obj()
_blackHole(obj)
// CHECK-CP: destroy_value [poison] %{{.*}} : $Obj{{.*}} line:[[@LINE+1]]:13:auto_gen
try foo(100)
// CHECK-SIL: bb{{.*}}(%{{[0-9]+}} : $()):
// CHECK-SIL-NEXT: strong_release {{.*}}: $Obj{{.*}} line:[[@LINE+1]]:3:cleanup
// CHECK-NCP-NEXT: strong_release {{.*}}: $Obj{{.*}} line:[[@LINE+1]]:3:cleanup
}
// CHECK-SIL-NEXT: = tuple ()
// CHECK-SIL-NEXT: return {{.*}} line:[[@LINE+1]]

View File

@@ -16,6 +16,7 @@ autoreleasepool {
// CHECK: {{^}}main.FullyNative{{$}}
print(c.description!)
_fixLifetime(c)
}
// CHECK-NEXT: dead

View File

@@ -1,7 +1,11 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/../Inputs/resilient_struct.swift -enable-library-evolution -emit-module -emit-module-path %t/resilient_struct.swiftmodule
// RUN: %target-swift-frontend %S/../Inputs/resilient_enum.swift -I %t -enable-library-evolution -emit-module -emit-module-path %t/resilient_enum.swiftmodule
// RUN: %target-swift-frontend %s -sil-verify-all -emit-sil -I %t -o - | %FileCheck %s --check-prefix=CHECK --check-prefix=%target-os
// RUN: %target-swift-frontend %s -sil-verify-all -emit-sil -disable-copy-propagation -I %t -o - | %FileCheck %s --check-prefix=CHECK --check-prefix=%target-os
// Using -disable-copy-propagation to pattern match against older SIL
// output. At least until -enable-copy-propagation has been around
// long enough in the same form to be worth rewriting CHECK lines.
import resilient_struct
import resilient_enum

View File

@@ -1,6 +1,10 @@
// RUN: %target-swift-frontend %s -sil-verify-all -emit-sil -o - -I %S/Inputs/usr/include | %FileCheck %s
// RUN: %target-swift-frontend %s -sil-verify-all -emit-sil -disable-copy-propagation -o - -I %S/Inputs/usr/include | %FileCheck %s
// REQUIRES: objc_interop
// Using -disable-copy-propagation to pattern match against older SIL
// output. At least until -enable-copy-propagation has been around
// long enough in the same form to be worth rewriting CHECK lines.
import Foundation
import ClosureLifetimeFixupObjC

View File

@@ -1,5 +1,9 @@
// RUN: %target-swift-frontend -module-name A -verify -emit-sil -import-objc-header %S/Inputs/Closure.h -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
// RUN: %target-swift-frontend -module-name A -verify -emit-sil -import-objc-header %S/Inputs/Closure.h -disable-objc-attr-requires-foundation-module -Xllvm -sil-disable-convert-escape-to-noescape-switch-peephole %s | %FileCheck %s --check-prefix=NOPEEPHOLE
// RUN: %target-swift-frontend -module-name A -verify -emit-sil -import-objc-header %S/Inputs/Closure.h -disable-copy-propagation -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
// RUN: %target-swift-frontend -module-name A -verify -emit-sil -import-objc-header %S/Inputs/Closure.h -disable-copy-propagation -disable-objc-attr-requires-foundation-module -Xllvm -sil-disable-convert-escape-to-noescape-switch-peephole %s | %FileCheck %s --check-prefix=NOPEEPHOLE
//
// Using -disable-copy-propagation to pattern match against older SIL
// output. At least until -enable-copy-propagation has been around
// long enough in the same form to be worth rewriting CHECK lines.
// REQUIRES: objc_interop

View File

@@ -1,4 +1,8 @@
// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
// RUN: %target-swift-frontend -emit-sil -disable-copy-propagation %s | %FileCheck %s
// Using -disable-copy-propagation to pattern match against older SIL
// output. At least until -enable-copy-propagation has been around
// long enough in the same form to be worth rewriting CHECK lines.
// High-level tests that DI handles early returns from failable and throwing
// initializers properly. The main complication is conditional release of self

View File

@@ -1,4 +1,8 @@
// RUN: %target-swift-frontend -emit-sil -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
// RUN: %target-swift-frontend -emit-sil -disable-copy-propagation -disable-objc-attr-requires-foundation-module %s | %FileCheck %s
// Using -disable-copy-propagation to pattern match against older SIL
// output. At least until -enable-copy-propagation has been around
// long enough in the same form to be worth rewriting CHECK lines.
// REQUIRES: objc_interop

View File

@@ -1,4 +1,8 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/../IDE/Inputs/custom-modules %s -emit-sil | %FileCheck %s
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/../IDE/Inputs/custom-modules %s -emit-sil -disable-copy-propagation | %FileCheck %s
// Using -disable-copy-propagation to pattern match against older SIL
// output. At least until -enable-copy-propagation has been around
// long enough in the same form to be worth rewriting CHECK lines.
// REQUIRES: objc_interop

View File

@@ -1,4 +1,8 @@
// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
// RUN: %target-swift-frontend -emit-sil -disable-copy-propagation %s | %FileCheck %s
// Using -disable-copy-propagation to pattern match against older SIL
// output. At least until -enable-copy-propagation has been around
// long enough in the same form to be worth rewriting CHECK lines.
class OtherClass {}