Skip to content

Commit

Permalink
Fixup some tests I missed since sil-opt was not running with +0 self …
Browse files Browse the repository at this point in the history
…enabled in all cases.

Swift SVN r27246
  • Loading branch information
gottesmm committed Apr 13, 2015
1 parent 5f12065 commit aa5fcab
Show file tree
Hide file tree
Showing 20 changed files with 174 additions and 193 deletions.
12 changes: 6 additions & 6 deletions test/SILPasses/capture_promotion.sil
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ bb0:

// The load of %1 is removed, and its uses replaced with the Foo argument
// CHECK-NEXT: strong_retain {{.*}} : $Foo
// CHECK-NEXT: [[METHOD_FOO:%.*]] = class_method {{.*}} : $Foo, #Foo.foo!1 : Foo -> () -> Int , $@cc(method) @thin (@owned Foo) -> Int
// CHECK-NEXT: [[APPLY_FOO:%.*]] = apply [[METHOD_FOO]]({{.*}}) : $@cc(method) @thin (@owned Foo) -> Int
// CHECK-NEXT: [[METHOD_FOO:%.*]] = class_method {{.*}} : $Foo, #Foo.foo!1 : Foo -> () -> Int , $@cc(method) @thin (@guaranteed Foo) -> Int
// CHECK-NEXT: [[APPLY_FOO:%.*]] = apply [[METHOD_FOO]]({{.*}}) : $@cc(method) @thin (@guaranteed Foo) -> Int

// The struct_element_addr of %3 followed by a load is replaced by a struct_extract of the Baz argument
// CHECK-NEXT: [[EXTRACT_BAZ_X:%.*]] = struct_extract {{.*}} : $Baz, #Baz.x
Expand All @@ -114,8 +114,8 @@ bb0(%0 : $Builtin.NativeObject, %1 : $*Foo, %2 : $Builtin.NativeObject, %3 : $*B
%7 = function_ref @dummy_func : $@thin (Int, Int, Int) -> Int
%8 = load %1 : $*Foo
strong_retain %8 : $Foo
%10 = class_method %8 : $Foo, #Foo.foo!1 : Foo -> () -> Int, $@cc(method) @thin (@owned Foo) -> Int
%11 = apply %10(%8) : $@cc(method) @thin (@owned Foo) -> Int
%10 = class_method %8 : $Foo, #Foo.foo!1 : Foo -> () -> Int, $@cc(method) @thin (@guaranteed Foo) -> Int
%11 = apply %10(%8) : $@cc(method) @thin (@guaranteed Foo) -> Int
%12 = struct_element_addr %3 : $*Baz, #Baz.x
%13 = load %12 : $*Int
%14 = load %5 : $*Int
Expand Down Expand Up @@ -154,8 +154,8 @@ bb0(%0 : $Builtin.NativeObject, %1 : $*Foo):
%7 = function_ref @dummy_func : $@thin (Int, Int, Int) -> Int
%8 = load %1 : $*Foo
strong_retain %8 : $Foo
%10 = class_method %8 : $Foo, #Foo.foo!1 : Foo -> () -> Int, $@cc(method) @thin (@owned Foo) -> Int
%11 = apply %10(%8) : $@cc(method) @thin (@owned Foo) -> Int
%10 = class_method %8 : $Foo, #Foo.foo!1 : Foo -> () -> Int, $@cc(method) @thin (@guaranteed Foo) -> Int
%11 = apply %10(%8) : $@cc(method) @thin (@guaranteed Foo) -> Int
%12 = function_ref @mutate_foo : $@thin (@inout Foo) -> ()
%13 = apply %12(%1) : $@thin (@inout Foo) -> ()
strong_release %0 : $Builtin.NativeObject
Expand Down
52 changes: 26 additions & 26 deletions test/SILPasses/devirt_access.sil
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ class K {
//CHECK: function_ref @_TFC4test1K4pongfS0_FT_Si
//CHECK-NEXT: apply
//CHECK-NEXT: return
sil @_TFC4test1K4pingfS0_FT_Si : $@cc(method) @thin (@owned K) -> Int {
sil @_TFC4test1K4pingfS0_FT_Si : $@cc(method) @thin (@guaranteed K) -> Int {
bb0(%0 : $K):
%1 = class_method %0 : $K, #K.pong!1 : K -> () -> Int , $@cc(method) @thin (@owned K) -> Int // user: %2
%2 = apply %1(%0) : $@cc(method) @thin (@owned K) -> Int // user: %3
%1 = class_method %0 : $K, #K.pong!1 : K -> () -> Int , $@cc(method) @thin (@guaranteed K) -> Int // user: %2
%2 = apply %1(%0) : $@cc(method) @thin (@guaranteed K) -> Int // user: %3
return %2 : $Int // id: %3
}

sil @_TFC5test21K4pongfS0_FT_Si : $@cc(method) @thin (@owned K) -> Int
sil @_TFC4test1K4pongfS0_FT_Si : $@cc(method) @thin (@owned K) -> Int
sil @_TFC4test1Kd : $@cc(method) @thin (@owned K) -> @owned Builtin.NativeObject
sil @_TFC4test1KD : $@cc(method) @thin (@owned K) -> ()
sil @_TFC5test21K4pongfS0_FT_Si : $@cc(method) @thin (@guaranteed K) -> Int
sil @_TFC4test1K4pongfS0_FT_Si : $@cc(method) @thin (@guaranteed K) -> Int
sil @_TFC4test1Kd : $@cc(method) @thin (@guaranteed K) -> @owned Builtin.NativeObject
sil @_TFC4test1KD : $@cc(method) @thin (@guaranteed K) -> ()
sil @_TFC4test1KcfMS0_FT_S0_ : $@cc(method) @thin (@owned K) -> @owned K
sil @_TFC4test1KCfMS0_FT_S0_ : $@thin (@thick K.Type) -> @owned K

Expand Down Expand Up @@ -65,24 +65,24 @@ class B : A
override init()
}

sil @_TFC14devirt_access21X4pingfS0_FT_Si : $@cc(method) @thin (@owned X) -> Int
sil @_TFC14devirt_access21X4pingfS0_FT_Si : $@cc(method) @thin (@guaranteed X) -> Int
sil public_external [transparent] @_TFSi33_convertFromBuiltinIntegerLiteralfMSiFBi2048_Si : $@thin (Builtin.Int2048, @thin Int.Type) -> Int
sil @_TFC14devirt_access21Xd : $@cc(method) @thin (@owned X) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21XD : $@cc(method) @thin (@owned X) -> ()
sil @_TFC14devirt_access21Xd : $@cc(method) @thin (@guaranteed X) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21XD : $@cc(method) @thin (@guaranteed X) -> ()
sil @_TFC14devirt_access21XcfMS0_FT_S0_ : $@cc(method) @thin (@owned X) -> @owned X
sil @_TFC14devirt_access21XCfMS0_FT_S0_ : $@thin (@thick X.Type) -> @owned X
sil @_TFC14devirt_access21Yd : $@cc(method) @thin (@owned Y) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21YD : $@cc(method) @thin (@owned Y) -> ()
sil @_TFC14devirt_access21Yd : $@cc(method) @thin (@guaranteed Y) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21YD : $@cc(method) @thin (@guaranteed Y) -> ()
sil @_TFC14devirt_access21YcfMS0_FT_S0_ : $@cc(method) @thin (@owned Y) -> @owned Y
sil @_TFC14devirt_access21YCfMS0_FT_S0_ : $@thin (@thick Y.Type) -> @owned Y
sil @_TFC14devirt_access21A4pingfS0_FT_Si : $@cc(method) @thin (@owned A) -> Int
sil @_TFC14devirt_access21Ad : $@cc(method) @thin (@owned A) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21AD : $@cc(method) @thin (@owned A) -> ()
sil @_TFC14devirt_access21A4pingfS0_FT_Si : $@cc(method) @thin (@guaranteed A) -> Int
sil @_TFC14devirt_access21Ad : $@cc(method) @thin (@guaranteed A) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21AD : $@cc(method) @thin (@guaranteed A) -> ()
sil @_TFC14devirt_access21AcfMS0_FT_S0_ : $@cc(method) @thin (@owned A) -> @owned A
sil @_TFC14devirt_access21ACfMS0_FT_S0_ : $@thin (@thick A.Type) -> @owned A
sil @_TFC14devirt_access21B4pingfS0_FT_Si : $@cc(method) @thin (@owned B) -> Int
sil @_TFC14devirt_access21Bd : $@cc(method) @thin (@owned B) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21BD : $@cc(method) @thin (@owned B) -> ()
sil @_TFC14devirt_access21B4pingfS0_FT_Si : $@cc(method) @thin (@guaranteed B) -> Int
sil @_TFC14devirt_access21Bd : $@cc(method) @thin (@guaranteed B) -> @owned Builtin.NativeObject
sil @_TFC14devirt_access21BD : $@cc(method) @thin (@guaranteed B) -> ()
sil @_TFC14devirt_access21BcfMS0_FT_S0_ : $@cc(method) @thin (@owned B) -> @owned B
sil @_TFC14devirt_access21BCfMS0_FT_S0_ : $@thin (@thick B.Type) -> @owned B

Expand All @@ -94,8 +94,8 @@ sil @Case1 : $@thin (@owned X) -> Int {
bb0(%0 : $X):
debug_value %0 : $X // let a // id: %1
strong_retain %0 : $X // id: %2
%3 = class_method %0 : $X, #X.ping!1 : X -> () -> Int , $@cc(method) @thin (@owned X) -> Int // user: %4
%4 = apply %3(%0) : $@cc(method) @thin (@owned X) -> Int // user: %6
%3 = class_method %0 : $X, #X.ping!1 : X -> () -> Int , $@cc(method) @thin (@guaranteed X) -> Int // user: %4
%4 = apply %3(%0) : $@cc(method) @thin (@guaranteed X) -> Int // user: %6
strong_release %0 : $X // id: %5
return %4 : $Int // id: %6
}
Expand All @@ -109,8 +109,8 @@ bb0(%0 : $Y):
debug_value %0 : $Y // let a // id: %1
strong_retain %0 : $Y // id: %2
%3 = upcast %0 : $Y to $X // users: %4, %5
%4 = class_method %3 : $X, #X.ping!1 : X -> () -> Int , $@cc(method) @thin (@owned X) -> Int // user: %5
%5 = apply %4(%3) : $@cc(method) @thin (@owned X) -> Int // user: %7
%4 = class_method %3 : $X, #X.ping!1 : X -> () -> Int , $@cc(method) @thin (@guaranteed X) -> Int // user: %5
%5 = apply %4(%3) : $@cc(method) @thin (@guaranteed X) -> Int // user: %7
strong_release %0 : $Y // id: %6
return %5 : $Int // id: %7
}
Expand All @@ -122,8 +122,8 @@ sil @Case3 : $@thin (@owned A) -> Int {
bb0(%0 : $A):
debug_value %0 : $A // let a // id: %1
strong_retain %0 : $A // id: %2
%3 = class_method %0 : $A, #A.ping!1 : A -> () -> Int , $@cc(method) @thin (@owned A) -> Int // user: %4
%4 = apply %3(%0) : $@cc(method) @thin (@owned A) -> Int // user: %6
%3 = class_method %0 : $A, #A.ping!1 : A -> () -> Int , $@cc(method) @thin (@guaranteed A) -> Int // user: %4
%4 = apply %3(%0) : $@cc(method) @thin (@guaranteed A) -> Int // user: %6
strong_release %0 : $A // id: %5
return %4 : $Int // id: %6
}
Expand All @@ -135,8 +135,8 @@ sil @Case4 : $@thin (@owned B) -> Int {
bb0(%0 : $B):
debug_value %0 : $B // let a // id: %1
strong_retain %0 : $B // id: %2
%3 = class_method %0 : $B, #B.ping!1 : B -> () -> Int , $@cc(method) @thin (@owned B) -> Int // user: %4
%4 = apply %3(%0) : $@cc(method) @thin (@owned B) -> Int // user: %6
%3 = class_method %0 : $B, #B.ping!1 : B -> () -> Int , $@cc(method) @thin (@guaranteed B) -> Int // user: %4
%4 = apply %3(%0) : $@cc(method) @thin (@guaranteed B) -> Int // user: %6
strong_release %0 : $B // id: %5
return %4 : $Int // id: %6
}
Expand Down
6 changes: 3 additions & 3 deletions test/SILPasses/devirt_alloc_ref_dynamic.sil
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class A {
}

// test.A.foo (test.A)() -> Swift.Int32
sil hidden @_TFC4test1A3foofS0_FT_VSs5Int32 : $@cc(method) @thin (@owned A) -> Int32 {
sil hidden @_TFC4test1A3foofS0_FT_VSs5Int32 : $@cc(method) @thin (@guaranteed A) -> Int32 {
bb0(%0 : $A):
debug_value %0 : $A
%2 = integer_literal $Builtin.Int32, 1
Expand All @@ -33,8 +33,8 @@ bb0:
%1 = metatype $@thick A.Type
%2 = alloc_ref_dynamic %1 : $@thick A.Type, $A
strong_retain %2 : $A
%8 = class_method %2 : $A, #A.foo!1 : A -> () -> Int32 , $@cc(method) @thin (@owned A) -> Int32
%9 = apply %8(%2) : $@cc(method) @thin (@owned A) -> Int32
%8 = class_method %2 : $A, #A.foo!1 : A -> () -> Int32 , $@cc(method) @thin (@guaranteed A) -> Int32
%9 = apply %8(%2) : $@cc(method) @thin (@guaranteed A) -> Int32
strong_release %2 : $A
return %9 : $Int32
}
Expand Down
14 changes: 6 additions & 8 deletions test/SILPasses/devirt_ctors.sil
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ bb0(%0 : $Int64, %1 : $ABC):
return %1 : $ABC // id: %38
}

sil @_TFC4main3ABC6memberfS0_FT_T_ : $@cc(method) @thin (@owned ABC) -> ()
sil @_TFC4main3ABC7member2fS0_FT_T_ : $@cc(method) @thin (@owned ABC) -> ()
sil @_TFC4main3ABC6memberfS0_FT_T_ : $@cc(method) @thin (@guaranteed ABC) -> ()
sil @_TFC4main3ABC7member2fS0_FT_T_ : $@cc(method) @thin (@guaranteed ABC) -> ()
sil @_TFC4main3ABCCfMS0_FT1ySi_S0_ : $@thin (Int64, @thick ABC.Type) -> @owned ABC

//CHECK:@_TF4main3fooFT_T_
Expand All @@ -34,12 +34,10 @@ bb0:
// function_ref main.ABC.init (main.ABC.Type)(y : Swift.Int64) -> main.ABC
%3 = function_ref @_TFC4main3ABCcfMS0_FT1ySi_S0_ : $@cc(method) @thin (Int64, @owned ABC) -> @owned ABC // user: %4
%4 = apply %3(%1, %2) : $@cc(method) @thin (Int64, @owned ABC) -> @owned ABC // users: %7, %6, %5, %10, %9, %8, %11
strong_retain %4 : $ABC // id: %5
%6 = class_method %4 : $ABC, #ABC.member!1 : ABC -> () -> () , $@cc(method) @thin (@owned ABC) -> () // user: %7
%7 = apply %6(%4) : $@cc(method) @thin (@owned ABC) -> ()
strong_retain %4 : $ABC // id: %8
%9 = class_method %4 : $ABC, #ABC.member2!1 : ABC -> () -> () , $@cc(method) @thin (@owned ABC) -> () // user: %10
%10 = apply %9(%4) : $@cc(method) @thin (@owned ABC) -> ()
%6 = class_method %4 : $ABC, #ABC.member!1 : ABC -> () -> () , $@cc(method) @thin (@guaranteed ABC) -> () // user: %7
%7 = apply %6(%4) : $@cc(method) @thin (@guaranteed ABC) -> ()
%9 = class_method %4 : $ABC, #ABC.member2!1 : ABC -> () -> () , $@cc(method) @thin (@guaranteed ABC) -> () // user: %10
%10 = apply %9(%4) : $@cc(method) @thin (@guaranteed ABC) -> ()
strong_release %4 : $ABC // id: %11
%12 = tuple () // user: %13
return %12 : $() // id: %13
Expand Down
Loading

0 comments on commit aa5fcab

Please sign in to comment.