File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
SwiftCompilerSources/Sources/Optimizer/FunctionPasses Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -289,14 +289,13 @@ private extension BasicBlockRange {
289
289
/// Returns true if there is a direct edge connecting this range with the `otherRange`.
290
290
func hasControlFlowEdge( to otherRange: BasicBlockRange ) -> Bool {
291
291
func isOnlyInOtherRange( _ block: BasicBlock ) -> Bool {
292
- return !inclusiveRangeContains( block) &&
293
- otherRange. inclusiveRangeContains ( block) && block != otherRange. begin
292
+ return !inclusiveRangeContains( block) && otherRange. inclusiveRangeContains ( block)
294
293
}
295
294
296
295
for lifeBlock in inclusiveRange {
297
296
assert ( otherRange. inclusiveRangeContains ( lifeBlock) , " range must be a subset of other range " )
298
297
for succ in lifeBlock. successors {
299
- if isOnlyInOtherRange ( succ) {
298
+ if isOnlyInOtherRange ( succ) && succ != otherRange . begin {
300
299
return true
301
300
}
302
301
// The entry of the begin-block is conceptually not part of the range. We can check if
Original file line number Diff line number Diff line change @@ -1209,3 +1209,27 @@ bb3:
1209
1209
br bb3
1210
1210
}
1211
1211
1212
+ // CHECK-LABEL: sil @inner_liferange_jumps_to_outer_in_header_block
1213
+ // CHECK: alloc_ref $XX
1214
+ // CHECK-LABEL: } // end sil function 'inner_liferange_jumps_to_outer_in_header_block'
1215
+ sil @inner_liferange_jumps_to_outer_in_header_block : $@convention(thin) (@owned XX) -> () {
1216
+ bb0(%0 : $XX):
1217
+ %1 = alloc_stack $XX
1218
+ br bb1(%0 : $XX)
1219
+
1220
+ bb1(%2 : $XX):
1221
+ strong_release %2 : $XX
1222
+ %4 = alloc_ref $XX
1223
+ store %4 to %1 : $*XX
1224
+ cond_br undef, bb2, bb3
1225
+
1226
+ bb2:
1227
+ br bb1(%4 : $XX)
1228
+
1229
+ bb3:
1230
+ strong_release %4 : $XX
1231
+ dealloc_stack %1 : $*XX
1232
+ %r = tuple ()
1233
+ return %r : $()
1234
+ }
1235
+
You can’t perform that action at this time.
0 commit comments