Skip to content

Commit

Permalink
[Test] Backport SIL tests to 6.1.
Browse files Browse the repository at this point in the history
On main type annotations are not always required but on 6.1 they are.
  • Loading branch information
nate-chandler committed Dec 16, 2024
1 parent ba6c70d commit 1726b32
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 46 deletions.
44 changes: 22 additions & 22 deletions test/SILOptimizer/mem2reg_ossa_nontrivial.sil
Original file line number Diff line number Diff line change
Expand Up @@ -1495,15 +1495,15 @@ sil [ossa] @test_store_enum_value_in_multiple_locs1 : $@convention(thin) () -> (
bb0:
%0 = function_ref @get : $@convention(thin) () -> @owned FakeOptional<Klass>
%1 = apply %0() : $@convention(thin) () -> @owned FakeOptional<Klass>
%2 = begin_borrow [lexical] %1
%2 = begin_borrow [lexical] %1 : $FakeOptional<Klass>
cond_br undef, bb2, bb1

bb1:
br bb3

bb2:
%5 = alloc_stack [lexical] $FakeOptional<Klass>
%6 = store_borrow %2 to %5
%6 = store_borrow %2 to %5 : $*FakeOptional<Klass>
cond_br undef, bb8, bb9

bb3:
Expand All @@ -1514,38 +1514,38 @@ bb4:

bb5:
%11 = alloc_stack $FakeOptional<Klass>
%12 = store_borrow %2 to %11
%14 = load_borrow %12
%15 = begin_borrow [lexical] %14
%12 = store_borrow %2 to %11 : $*FakeOptional<Klass>
%14 = load_borrow %12 : $*FakeOptional<Klass>
%15 = begin_borrow [lexical] %14 : $FakeOptional<Klass>
%16 = alloc_stack $FakeOptional<Klass>
%17 = store_borrow %15 to %16
%17 = store_borrow %15 to %16 : $*FakeOptional<Klass>
cond_br undef, bb6, bb7

bb6:
fix_lifetime %17
end_borrow %17
dealloc_stack %16
end_borrow %15
end_borrow %14
end_borrow %12
dealloc_stack %11
end_borrow %2
destroy_value %1
fix_lifetime %17 : $*FakeOptional<Klass>
end_borrow %17 : $*FakeOptional<Klass>
dealloc_stack %16 : $*FakeOptional<Klass>
end_borrow %15 : $FakeOptional<Klass>
end_borrow %14 : $FakeOptional<Klass>
end_borrow %12 : $*FakeOptional<Klass>
dealloc_stack %11 : $*FakeOptional<Klass>
end_borrow %2 : $FakeOptional<Klass>
destroy_value %1 : $FakeOptional<Klass>
%29 = tuple ()
return %29
return %29 : $()

bb7:
end_borrow %17
dealloc_stack %16
end_borrow %17 : $*FakeOptional<Klass>
dealloc_stack %16 : $*FakeOptional<Klass>
unreachable

bb8:
end_borrow %6
dealloc_stack %5
end_borrow %6 : $*FakeOptional<Klass>
dealloc_stack %5 : $*FakeOptional<Klass>
unreachable

bb9:
end_borrow %6
dealloc_stack %5
end_borrow %6 : $*FakeOptional<Klass>
dealloc_stack %5 : $*FakeOptional<Klass>
br bb3
}
48 changes: 24 additions & 24 deletions test/SILOptimizer/ossa_lifetime_completion.sil
Original file line number Diff line number Diff line change
Expand Up @@ -834,16 +834,16 @@ sil [ossa] @load_borrow_of_store_borrow_1 : $@convention(thin) (@guaranteed C) -
entry(%instance : @guaranteed $C):
specify_test "ossa_lifetime_completion %token availability"
%addr = alloc_stack $C
%token = store_borrow %instance to %addr
%load = load_borrow %token
%borrow = begin_borrow %load
%token = store_borrow %instance to %addr : $*C
%load = load_borrow %token : $*C
%borrow = begin_borrow %load : $C
cond_br undef, exit, die

exit:
end_borrow %borrow
end_borrow %load
end_borrow %token
dealloc_stack %addr
end_borrow %borrow : $C
end_borrow %load : $C
end_borrow %token : $*C
dealloc_stack %addr : $*C
%retval = tuple ()
return %retval : $()
die:
Expand All @@ -867,34 +867,34 @@ sil [ossa] @load_borrow_of_store_borrow_2 : $@convention(thin) (@guaranteed C) -
entry(%instance : @guaranteed $C):
specify_test "ossa_lifetime_completion %token availability"
%addr = alloc_stack $C
%token = store_borrow %instance to %addr
%load = load_borrow %token
%borrow = begin_borrow %load
%token = store_borrow %instance to %addr : $*C
%load = load_borrow %token : $*C
%borrow = begin_borrow %load : $C
cond_br undef, exit, die

exit:
end_borrow %borrow
end_borrow %load
end_borrow %token
dealloc_stack %addr
end_borrow %borrow : $C
end_borrow %load : $C
end_borrow %token : $*C
dealloc_stack %addr : $*C
%retval = tuple ()
return %retval : $()
die:
end_borrow %borrow
end_borrow %load
end_borrow %borrow : $C
end_borrow %load : $C
unreachable
}

sil [ossa] @load_borrow_1 : $@convention(thin) (@in_guaranteed C) -> () {
entry(%addr : $*C):
specify_test "ossa_lifetime_completion %load availability"
%load = load_borrow %addr
%borrow = begin_borrow %load
%load = load_borrow %addr : $*C
%borrow = begin_borrow %load : $C
cond_br undef, exit, die

exit:
end_borrow %borrow
end_borrow %load
end_borrow %borrow : $C
end_borrow %load : $C
%retval = tuple ()
return %retval : $()
die:
Expand Down Expand Up @@ -943,13 +943,13 @@ sil [ossa] @load_borrow_of_begin_access : $@convention(thin) (@in_guaranteed C)
entry(%addr : $*C):
specify_test "ossa_lifetime_completion %access availability"
%access = begin_access [static] [read] %addr : $*C
%load = load_borrow %access
%borrow = begin_borrow %load
%load = load_borrow %access : $*C
%borrow = begin_borrow %load : $C
cond_br undef, exit, die

exit:
end_borrow %borrow
end_borrow %load
end_borrow %borrow : $C
end_borrow %load : $C
end_access %access : $*C
%retval = tuple ()
return %retval : $()
Expand Down

0 comments on commit 1726b32

Please sign in to comment.