Files
swift-mirror/test/IRGen/unknown_object.sil
Michael Gottesman 702c1bc5e8 [arc] Change guaranteed arc opts to be based on SemanticARCOpts and move from Diagnostic pipeline -> Onone pipeline.
The pass is already not being run during normal compilation scenarios today
since it bails on OSSA except in certain bit-rot situations where a test wasn't
updated and so was inadvertently invoking the pass. I discovered these while
originally just trying to eliminate the pass from the diagnostic pipeline. The
reason why I am doing this in one larger change is that I found there were a
bunch of sil tests inadvertently relying on guaranteed arc opts to eliminate
copy traffic. So, if I just removed this and did this in two steps, I would
basically be unoptimizing then re-optimizing the tests.

Some notes:

1. The new guaranteed arc opts is based off of SemanticARCOpts and runs only on
   ossa. Specifically, in this new pass, we just perform simple
   canonicalizations that do not involve any significant analysis. Some
   examples: a copy_value all of whose uses are destroys. This will do what the
   original pass did and more without more compile time. I did a conservative
   first approximation, but we can probably tune this a bit.

2. the reason why I am doing this now is that I was trying to eliminate the
   enable-ownership-stripping-after-serialization flag and discovered that the
   test opaque_value_mandatory implicitly depends on this since sil-opt by
   default was the only place left in the compiler with that option set to false
   by default. So I am eliminating that dependency before I land the larger
   change.
2020-06-15 17:00:18 -07:00

25 lines
876 B
Plaintext

// RUN: %target-swift-frontend -emit-ir %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-runtime %s
sil_stage canonical
import Builtin
sil @anyobject_user : $@convention(thin) (@guaranteed Builtin.AnyObject) -> ()
// CHECK-LABEL: @retain_release_unknown_object
sil [ossa] @retain_release_unknown_object : $@convention(thin) (@guaranteed Builtin.AnyObject) -> () {
entry(%x : @guaranteed $Builtin.AnyObject):
// CHECK-native: swift_retain
// CHECK-objc: swift_unknownObjectRetain
%y = copy_value %x : $Builtin.AnyObject
br bb1
bb1:
%func = function_ref @anyobject_user : $@convention(thin) (@guaranteed Builtin.AnyObject) -> ()
apply %func(%y) : $@convention(thin) (@guaranteed Builtin.AnyObject) -> ()
// CHECK-native: swift_release
// CHECK-objc: swift_unknownObjectRelease
destroy_value %y : $Builtin.AnyObject
return undef : $()
}