Files
swift-mirror/test/SIL/Parser/borrow_argument.sil
Meghana Gupta 1dc713e2f7 Add new flags "reborrow" and "escaping" to SILArgument.
"reborrow" flag on the SILArgument avoids transitive walk over the phi operandsi
to determine if it is a reborrow in multiple utilities.
SIL transforms must keep the flag up-to-date by calling SILArgument::setReborrow.
SILVerifier checks to ensure the flag is not invalidated.

Currently "escaping" is not used anywhere.
2023-05-11 12:31:37 -07:00

21 lines
697 B
Plaintext

// RUN: %target-sil-opt %s | %target-sil-opt | %FileCheck %s
sil_stage canonical
import Builtin
// CHECK-LABEL: sil [ossa] @borrow_argument_test : $@convention(thin) (@guaranteed Builtin.NativeObject) -> () {
// CHECK: bb1([[PHIBBARG:%.*]] : @reborrow @guaranteed $Builtin.NativeObject):
// CHECK: end_borrow [[PHIBBARG]] : $Builtin.NativeObject
sil [ossa] @borrow_argument_test : $@convention(thin) (@guaranteed Builtin.NativeObject) -> () {
bb0(%0 : @guaranteed $Builtin.NativeObject):
%1 = begin_borrow %0 : $Builtin.NativeObject
br bb1(%1 : $Builtin.NativeObject)
bb1(%2 : @guaranteed $Builtin.NativeObject):
end_borrow %2 : $Builtin.NativeObject
%4 = tuple()
return %4 : $()
}