Files
swift-mirror/test/Misc/tbi.sil
Michael Gottesman f854547c55 [ownership] Enable ownership verification by default.
I also removed the -verify-sil-ownership flag in favor of a disable flag
-disable-sil-ownership-verifier. I used this on only two tests that still need
work to get them to pass with ownership, but whose problems are well understood,
small corner cases. I am going to fix them in follow on commits. I detail them
below:

1. SILOptimizer/definite_init_inout_super_init.swift. This is a test case where
DI is supposed to error. The only problem is that we crash before we error since
the code emitting by SILGen to trigger this error does not pass ownership
invariants. I have spoken with JoeG about this and he suggested that I fix this
earlier in the compiler. Since we do not run the ownership verifier without
asserts enabled, this should not affect compiler users. Given that it has
triggered DI errors previously I think it is safe to disable ownership here.

2. PrintAsObjC/extensions.swift. In this case, the signature generated by type
lowering for one of the thunks here uses an unsafe +0 return value instead of
doing an autorelease return. The ownership checker rightly flags this leak. This
is going to require either an AST level change or a change to TypeLowering. I
think it is safe to turn this off since it is such a corner case that it was
found by a test that has nothing to do with it.

rdar://43398898
2019-03-25 00:11:52 -07:00

44 lines
1.6 KiB
Plaintext

// *NOTE* This is an end to end test. Specifically, we are ensuring that the
// driver is properly generated -enable-aarch64-tbi and also that the frontend
// respects this option and that we get the proper tbi behavior.
// RUN: %swiftc_driver -parse-sil -Xfrontend -disable-legacy-type-info -target arm64-apple-ios8.0 -target-cpu cyclone \
// RUN: -O -S %s -parse-as-library -parse-stdlib -module-name Swift \
// RUN: | \
// RUN: %FileCheck --check-prefix=TBI %s
// RUN: %swiftc_driver -parse-sil -Xfrontend -disable-legacy-type-info -target arm64-apple-ios7.0 -target-cpu cyclone \
// RUN: -O -S %s -parse-as-library -parse-stdlib -module-name Swift \
// RUN: | \
// RUN: %FileCheck --check-prefix=NO_TBI %s
// REQUIRES: CODEGENERATOR=AArch64
// Verify that TBI is on by default in Swift on targets that support it. For our
// purposes this means iOS8.0 or later.
// NO_TBI-LABEL: .globl _testTBI
// NO_TBI: _testTBI
// NO_TBI-NEXT: and
// NO_TBI-NEXT: ldr
// NO_TBI-NEXT: ret
// TBI-LABEL: .globl _testTBI
// TBI: _testTBI:
// TBI-NEXT: ldr
// TBI-NEXT: ret
sil_stage canonical
import Builtin
sil [ossa] @testTBI : $@convention(thin) (Builtin.Int64) -> Builtin.Int64 {
bb0(%0 : $Builtin.Int64):
%1 = integer_literal $Builtin.Int64, 0x00FFFFFFFFFFFFFF
%2 = builtin "and_Int64"(%0 : $Builtin.Int64, %1 : $Builtin.Int64) : $Builtin.Int64
%3 = builtin "inttoptr_Int64"(%2 : $Builtin.Int64) : $Builtin.RawPointer
%4 = pointer_to_address %3 : $Builtin.RawPointer to [strict] $*Builtin.Int64
%5 = load [trivial] %4 : $*Builtin.Int64
return %5 : $Builtin.Int64
}