| |
| // 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: } |