File: devirtualize_coroutine_accessors.sil

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (50 lines) | stat: -rw-r--r-- 1,442 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
// RUN: %target-sil-opt \
// RUN:     -devirtualizer \
// RUN:     %s \
// RUN:     -enable-sil-verify-all \
// RUN:     -enable-experimental-feature CoroutineAccessors \
// RUN: | %FileCheck %s

// REQUIRES: swift_feature_CoroutineAccessors

import Builtin

struct Int {
  var _value: Builtin.Word
}

class Base {
  var x : Int { read }
}

class Derived : Base {
  override var x : Int { read }
}

// CHECK-LABEL: sil [ossa] @utilize_begin_apply : {{.*}} {
// CHECK-NOT:     class_method
// CHECK-LABEL: } // end sil function 'utilize_begin_apply'
sil [ossa] @utilize_begin_apply : $@convention(thin) () -> () {
bb0:
  %derived = alloc_ref $Derived
  %base = upcast %derived : $Derived to $Base
  %reader = class_method %base : $Base, #Base.x!read2 : (Base) -> () -> (), $@yield_once_2 @convention(method) (@guaranteed Base) -> @yields Int
  (%value, %token, %allocation) = begin_apply %reader(%base) : $@yield_once_2 @convention(method) (@guaranteed Base) -> @yields Int
  end_apply %token as $()
  dealloc_stack %allocation : $*Builtin.SILToken
  destroy_value %base : $Base
  %retval = tuple ()
  return %retval : $()
}

sil [ossa] @Base_x_read2 : $@yield_once_2 @convention(method) (@guaranteed Base) -> @yields Int

sil [ossa] @Derived_x_read2 : $@yield_once_2 @convention(method) (@guaranteed Base) -> @yields Int

sil_vtable Base {
  #Base.x!read2: @Base_x_read2
}

sil_vtable Derived {
  #Base.x!read2: @Derived_x_read2 [override]
}