File: licm_multiend.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 (214 lines) | stat: -rw-r--r-- 8,863 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// RUN: %target-sil-opt -enable-sil-verify-all %s -licm | %FileCheck %s
// REQUIRES: CPU=x86_64
// REQUIRES: OS=macosx

sil_stage canonical

import Builtin
import Swift
import SwiftShims

var x: Int

let reversedArray: ReversedCollection<[Int]>

// x
sil_global hidden @$s3tmp1xSivp : $Int

// reversedArray
sil_global hidden [let] @$s3tmp13reversedArrays18ReversedCollectionVySaySiGGvp : $ReversedCollection<Array<Int>>

// _swiftEmptyArrayStorage
sil_global @_swiftEmptyArrayStorage : $_SwiftEmptyArrayStorage


// CHECK-LABEL: sil hidden @multi_end_licm : $@convention(thin) () -> () {
// CHECK: bb2:
// CHECK: [[GLOBALVAR:%.*]] = global_addr @$s3tmp1xSivp : $*Int
// CHECK: [[BEGINA:%.*]] = begin_access [modify] [dynamic] [no_nested_conflict] [[GLOBALVAR]] : $*Int
// CHECK: br [[LOOPH:bb[0-9]+]]({{.*}} : $Builtin.Int64)
// CHECK: [[LOOPH]]({{.*}} : $Builtin.Int64)
// CHECK: cond_br {{.*}}, [[LOOPCOND1:bb[0-9]+]], [[LOOPCOND2:bb[0-9]+]]
// CHECK: [[LOOPCOND1]]:
// CHECK-NEXT: store
// CHECK-NEXT: cond_br {{.*}}, [[LOOPEXIT1:bb[0-9]+]], [[LOOPCONT1:bb[0-9]+]]
// CHECK: [[LOOPEXIT1]]:
// CHECK-NEXT: end_access [[BEGINA]] : $*Int
// CHECK-NEXT: br [[LOOPAFTEREXIT:bb[0-9]+]]
// CHECK: [[LOOPCOND2]]:
// CHECK-NEXT: struct $Int
// CHECK-NEXT: store
// CHECK-NEXT: cond_br {{.*}}, [[LOOPEXIT2:bb[0-9]+]], [[LOOPCONT1]]
// CHECK: [[LOOPEXIT2]]:
// CHECK-NEXT: end_access [[BEGINA]] : $*Int
// CHECK-NEXT: br [[LOOPAFTEREXIT]]
// CHECK: [[LOOPCONT1]]:
// CHECK-NEXT: br [[LOOPH]]
// CHECK: [[LOOPAFTEREXIT]]:
// CHECK-NEXT: br [[FUNCRET:bb[0-9]+]]
// CHECK: [[FUNCRET]]:
// CHECK-NEXT: tuple
// CHECK-NEXT: return
sil hidden @multi_end_licm : $@convention(thin) () -> () {
bb0:
  %0 = global_addr @$s3tmp13reversedArrays18ReversedCollectionVySaySiGGvp : $*ReversedCollection<Array<Int>>
  %1 = struct_element_addr %0 : $*ReversedCollection<Array<Int>>, #ReversedCollection._base
  %2 = struct_element_addr %1 : $*Array<Int>, #Array._buffer
  %3 = struct_element_addr %2 : $*_ArrayBuffer<Int>, #_ArrayBuffer._storage
  %4 = struct_element_addr %3 : $*_BridgeStorage<__ContiguousArrayStorageBase>, #_BridgeStorage.rawValue
  %5 = load %4 : $*Builtin.BridgeObject
  %6 = unchecked_ref_cast %5 : $Builtin.BridgeObject to $__ContiguousArrayStorageBase
  %7 = ref_element_addr %6 : $__ContiguousArrayStorageBase, #__ContiguousArrayStorageBase.countAndCapacity
  %8 = struct_element_addr %7 : $*_ArrayBody, #_ArrayBody._storage
  %9 = struct_element_addr %8 : $*_SwiftArrayBodyStorage, #_SwiftArrayBodyStorage.count
  %10 = struct_element_addr %9 : $*Int, #Int._value
  %11 = load %10 : $*Builtin.Int64
  %12 = builtin "assumeNonNegative_Int64"(%11 : $Builtin.Int64) : $Builtin.Int64
  %13 = integer_literal $Builtin.Int64, 0
  %14 = integer_literal $Builtin.Int1, 0
  %15 = builtin "cmp_eq_Int64"(%12 : $Builtin.Int64, %13 : $Builtin.Int64) : $Builtin.Int1
  %16 = builtin "int_expect_Int1"(%15 : $Builtin.Int1, %14 : $Builtin.Int1) : $Builtin.Int1
  cond_br %16, bb1, bb2

bb1:
  br bb12

bb2:
  %19 = global_addr @$s3tmp1xSivp : $*Int
  %20 = integer_literal $Builtin.Int64, 1
  %21 = integer_literal $Builtin.Int1, -1
  %23 = ref_tail_addr %6 : $__ContiguousArrayStorageBase, $Int
  br bb4(%12 : $Builtin.Int64)

bb4(%27 : $Builtin.Int64):
  %28 = builtin "ssub_with_overflow_Int64"(%27 : $Builtin.Int64, %20 : $Builtin.Int64, %21 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
  %29 = tuple_extract %28 : $(Builtin.Int64, Builtin.Int1), 0
  %30 = tuple_extract %28 : $(Builtin.Int64, Builtin.Int1), 1
  cond_fail %30 : $Builtin.Int1
  %32 = builtin "cmp_slt_Int64"(%29 : $Builtin.Int64, %13 : $Builtin.Int64) : $Builtin.Int1
  %33 = load %10 : $*Builtin.Int64
  %34 = builtin "assumeNonNegative_Int64"(%33 : $Builtin.Int64) : $Builtin.Int64 
  %35 = builtin "cmp_slt_Int64"(%29 : $Builtin.Int64, %34 : $Builtin.Int64) : $Builtin.Int1
  %36 = builtin "xor_Int1"(%35 : $Builtin.Int1, %21 : $Builtin.Int1) : $Builtin.Int1
  %37 = builtin "or_Int1"(%32 : $Builtin.Int1, %36 : $Builtin.Int1) : $Builtin.Int1
  cond_fail %37 : $Builtin.Int1
  %39 = builtin "truncOrBitCast_Int64_Word"(%29 : $Builtin.Int64) : $Builtin.Word
  %40 = index_addr %23 : $*Int, %39 : $Builtin.Word
  %41 = struct_element_addr %40 : $*Int, #Int._value
  %42 = load %41 : $*Builtin.Int64
  %43 = struct $Int (%42 : $Builtin.Int64)
  debug_value %43 : $Int, let, name "item"
  %global = begin_access [modify] [dynamic] [no_nested_conflict] %19 : $*Int
  %46 = builtin "cmp_eq_Int64"(%29 : $Builtin.Int64, %13 : $Builtin.Int64) : $Builtin.Int1
  %47 = builtin "int_expect_Int1"(%46 : $Builtin.Int1, %14 : $Builtin.Int1) : $Builtin.Int1
  cond_br %47, bb10, bb11

bb10:
  store %43 to %global : $*Int
  end_access %global : $*Int
  cond_br %47, bb6, bb5

bb11:
  %otherInt = struct $Int (%27 : $Builtin.Int64)
  store %otherInt to %global : $*Int
  end_access %global : $*Int
  cond_br %47, bb6, bb5

bb5:
  br bb4(%29 : $Builtin.Int64)

bb6:
  br bb12

bb12:
  %25 = tuple ()
  return %25 : $()
} // end sil function 'multi_end_licm'

// CHECK-LABEL: sil hidden @multi_end_licm_loop_exit : $@convention(thin) () -> () {
// CHECK: br [[LOOPH:bb[0-9]+]]({{.*}} : $Builtin.Int64)
// CHECK: [[LOOPH]]({{.*}} : $Builtin.Int64)
// CHECK: begin_access [modify] [dynamic] [no_nested_conflict]
// CHECK: cond_br {{.*}}, [[LOOPCOND1:bb[0-9]+]], [[LOOPCOND2:bb[0-9]+]]
// CHECK: [[LOOPCOND1]]
// CHECK-NEXT: store
// CHECK-NEXT: end_access
// CHECK: return
sil hidden @multi_end_licm_loop_exit : $@convention(thin) () -> () {
bb0:
  %0 = global_addr @$s3tmp13reversedArrays18ReversedCollectionVySaySiGGvp : $*ReversedCollection<Array<Int>>
  %1 = struct_element_addr %0 : $*ReversedCollection<Array<Int>>, #ReversedCollection._base
  %2 = struct_element_addr %1 : $*Array<Int>, #Array._buffer
  %3 = struct_element_addr %2 : $*_ArrayBuffer<Int>, #_ArrayBuffer._storage
  %4 = struct_element_addr %3 : $*_BridgeStorage<__ContiguousArrayStorageBase>, #_BridgeStorage.rawValue
  %5 = load %4 : $*Builtin.BridgeObject
  %6 = unchecked_ref_cast %5 : $Builtin.BridgeObject to $__ContiguousArrayStorageBase
  %7 = ref_element_addr %6 : $__ContiguousArrayStorageBase, #__ContiguousArrayStorageBase.countAndCapacity
  %8 = struct_element_addr %7 : $*_ArrayBody, #_ArrayBody._storage
  %9 = struct_element_addr %8 : $*_SwiftArrayBodyStorage, #_SwiftArrayBodyStorage.count
  %10 = struct_element_addr %9 : $*Int, #Int._value
  %11 = load %10 : $*Builtin.Int64
  %12 = builtin "assumeNonNegative_Int64"(%11 : $Builtin.Int64) : $Builtin.Int64
  %13 = integer_literal $Builtin.Int64, 0
  %14 = integer_literal $Builtin.Int1, 0
  %15 = builtin "cmp_eq_Int64"(%12 : $Builtin.Int64, %13 : $Builtin.Int64) : $Builtin.Int1
  %16 = builtin "int_expect_Int1"(%15 : $Builtin.Int1, %14 : $Builtin.Int1) : $Builtin.Int1
  cond_br %16, bb1, bb2

bb1:
  br bbRet

bb2:
  %19 = global_addr @$s3tmp1xSivp : $*Int
  %20 = integer_literal $Builtin.Int64, 1
  %21 = integer_literal $Builtin.Int1, -1
  %23 = ref_tail_addr %6 : $__ContiguousArrayStorageBase, $Int
  br bb4(%12 : $Builtin.Int64)

bb4(%27 : $Builtin.Int64):
  %28 = builtin "ssub_with_overflow_Int64"(%27 : $Builtin.Int64, %20 : $Builtin.Int64, %21 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1)
  %29 = tuple_extract %28 : $(Builtin.Int64, Builtin.Int1), 0
  %30 = tuple_extract %28 : $(Builtin.Int64, Builtin.Int1), 1
  cond_fail %30 : $Builtin.Int1
  %32 = builtin "cmp_slt_Int64"(%29 : $Builtin.Int64, %13 : $Builtin.Int64) : $Builtin.Int1
  %33 = load %10 : $*Builtin.Int64
  %34 = builtin "assumeNonNegative_Int64"(%33 : $Builtin.Int64) : $Builtin.Int64 
  %35 = builtin "cmp_slt_Int64"(%29 : $Builtin.Int64, %34 : $Builtin.Int64) : $Builtin.Int1
  %36 = builtin "xor_Int1"(%35 : $Builtin.Int1, %21 : $Builtin.Int1) : $Builtin.Int1
  %37 = builtin "or_Int1"(%32 : $Builtin.Int1, %36 : $Builtin.Int1) : $Builtin.Int1
  cond_fail %37 : $Builtin.Int1
  %39 = builtin "truncOrBitCast_Int64_Word"(%29 : $Builtin.Int64) : $Builtin.Word
  %40 = index_addr %23 : $*Int, %39 : $Builtin.Word
  %41 = struct_element_addr %40 : $*Int, #Int._value
  %42 = load %41 : $*Builtin.Int64
  %43 = struct $Int (%42 : $Builtin.Int64)
  debug_value %43 : $Int, let, name "item"
  %global = begin_access [modify] [dynamic] [no_nested_conflict] %19 : $*Int
  %46 = builtin "cmp_eq_Int64"(%29 : $Builtin.Int64, %13 : $Builtin.Int64) : $Builtin.Int1
  %47 = builtin "int_expect_Int1"(%46 : $Builtin.Int1, %14 : $Builtin.Int1) : $Builtin.Int1
  cond_br %47, bbend1, bbend2
  
bbend1:
  store %43 to %global : $*Int
  end_access %global : $*Int
  cond_br %47, bb6, bb5
  
bbend2:
  %otherInt = struct $Int (%27 : $Builtin.Int64)
  store %otherInt to %global : $*Int
  cond_br %47, bbOut, bb5

bbOut:
  end_access %global : $*Int
  br bb6

bb5:
  br bb4(%29 : $Builtin.Int64)

bb6:
  br bbRet
  
bbRet:
  %25 = tuple ()
  return %25 : $()
} // end sil function 'multi_end_licm_loop_exit'