File: global_property_opt_objc.sil

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (51 lines) | stat: -rw-r--r-- 1,799 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// RUN: %target-sil-opt -enable-sil-verify-all -global-property-opt %s | %FileCheck %s

// REQUIRES: objc_interop

sil_stage canonical

import Builtin
import Swift
import SwiftShims

public class X {
}

// CHECK-LABEL: sil @test_unknown_init
// CHECK: [[F:%[0-9]+]] = function_ref @_is_native_X_no_type_check
// CHECK: [[R:%[0-9]+]] = apply [[F]]
// CHECK: return [[R]]
sil @test_unknown_init : $@convention(thin) (@owned _ArrayBuffer<X>) -> Bool {
bb0(%0 : $_ArrayBuffer<X>):
  %a1 = struct $Array<X> (%0 : $_ArrayBuffer<X>)

  %f1 = function_ref @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array<X>) -> Bool
  %10 = apply %f1(%a1) : $@convention(method) (@guaranteed Array<X>) -> Bool
  return %10 : $Bool
}

// CHECK-LABEL: sil @test_buffer_overwritten
// CHECK: [[F:%[0-9]+]] = function_ref @_is_native_X_no_type_check
// CHECK: [[R:%[0-9]+]] = apply [[F]]
// CHECK: return [[R]]
sil @test_buffer_overwritten : $@convention(thin) (@owned _ArrayBuffer<X>) -> Bool {
bb0(%0 : $_ArrayBuffer<X>):
  %1 = alloc_stack $Array<X>
  %3 = function_ref @_array_X_init : $@convention(thin) () -> @owned Array<X>
  %4 = apply %3() : $@convention(thin) () -> @owned Array<X>
  store %4 to %1 : $*Array<X>

  %b1 = struct_element_addr %1 : $*Array<X>, #Array._buffer
  store %0 to %b1 : $*_ArrayBuffer<X>

  %5 = load %1 : $*Array<X>
  %6 = function_ref @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array<X>) -> Bool
  %10 = apply %6(%5) : $@convention(method) (@guaranteed Array<X>) -> Bool
  dealloc_stack %1 : $*Array<X>
  return %10 : $Bool
}

sil [_semantics "array.init"] @_array_X_init : $@convention(thin) () -> @owned Array<X>

sil [_semantics "array.props.isNativeTypeChecked"] @_is_native_X_no_type_check : $@convention(method) (@guaranteed Array<X>) -> Bool