Files
swift-mirror/test/SILOptimizer/ownership_model_eliminator_resilience.sil
Slava Pestov 16d5716e71 SIL: Use the best resilience expansion when lowering types
This is a large patch; I couldn't split it up further while still
keeping things working. There are four things being changed at
once here:

- Places that call SILType::isAddressOnly()/isLoadable() now call
  the SILFunction overload and not the SILModule one.

- SILFunction's overloads of getTypeLowering() and getLoweredType()
  now pass the function's resilience expansion down, instead of
  hardcoding ResilienceExpansion::Minimal.

- Various other places with '// FIXME: Expansion' now use a better
  resilience expansion.

- A few tests were updated to reflect SILGen's improved code
  generation, and some new tests are added to cover more code paths
  that previously were uncovered and only manifested themselves as
  standard library build failures while I was working on this change.
2019-04-26 22:47:59 -04:00

43 lines
1.1 KiB
Plaintext

// RUN: %target-sil-opt -ownership-model-eliminator -enable-library-evolution %s | %FileCheck %s
// copy_value and destroy_value operations are lowered away, except for
// address-only types. Make sure we use the correct resilience expansion
// when checking if something is address-only.
sil_stage raw
import Builtin
import Swift
import SwiftShims
public class Saddle {
init()
deinit
}
public enum Animal {
case cat
case horse(Saddle)
}
sil [ossa] @$test_copy_destroy_value : $@convention(thin) (@guaranteed Saddle) -> () {
bb0(%0 : @guaranteed $Saddle):
%3 = copy_value %0 : $Saddle
%4 = enum $Animal, #Animal.horse!enumelt.1, %3 : $Saddle
%5 = copy_value %4 : $Animal
destroy_value %4 : $Animal
destroy_value %5 : $Animal
%6 = tuple ()
return %6 : $()
}
// CHECK-LABEL: sil @$test_copy_destroy_value : $@convention(thin) (@guaranteed Saddle) -> () {
// CHECK: bb0(%0 : $Saddle):
// CHECK: strong_retain %0 : $Saddle
// CHECK: %2 = enum $Animal, #Animal.horse!enumelt.1, %0 : $Saddle
// CHECK: release_value %2 : $Animal
// CHECK: %4 = tuple ()
// CHECK: return %4 : $()
// CHECK: }