@@ -7,35 +7,52 @@ import Builtin
7
7
import Swift
8
8
import SwiftShims
9
9
10
- func foo(x: Int, y: Int) -> Int
11
-
12
- sil_scope 1 { loc "file.swift":1:6 parent @foo : $@convention(thin) (Int, Int) -> Int }
10
+ sil_scope 1 { loc "file.swift":1:6 parent @foo : $@convention(thin) (Int64, Int64) -> Int64 }
13
11
14
12
// Test if debug_value got preserved when %16 is removed in favor of directly using %13
15
13
// CHECK-LABEL: sil {{.*}} @foo
16
- sil hidden @foo : $@convention(thin) (Int, Int ) -> Int {
17
- bb0(%0 : $Int , %1 : $Int ):
14
+ sil hidden @foo : $@convention(thin) (Int64, Int64 ) -> Int64 {
15
+ bb0(%0 : $Int64 , %1 : $Int64 ):
18
16
%4 = integer_literal $Builtin.Int64, 87, loc "file.swift":2:17, scope 1
19
- %9 = struct_extract %0 : $Int , #Int ._value, loc "file.swift":2:15, scope 1
17
+ %9 = struct_extract %0 : $Int64 , #Int64 ._value, loc "file.swift":2:15, scope 1
20
18
%11 = integer_literal $Builtin.Int1, -1, loc "file.swift":2:15, scope 1
21
19
// CHECK: %[[ADD:.+]] = builtin "sadd_with_overflow
22
20
%12 = builtin "sadd_with_overflow_Int64"(%9 : $Builtin.Int64, %4 : $Builtin.Int64, %11 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1), loc "file.swift":2:15, scope 1
23
21
// CHECK: (%[[RESULT:.+]], %{{.*}}) = destructure_tuple %[[ADD]]
24
22
(%13, %14) = destructure_tuple %12 : $(Builtin.Int64, Builtin.Int1), loc "file.swift":2:15, scope 1
25
- %16 = struct $Int (%13 : $Builtin.Int64), loc "file.swift":2:15, scope 1
23
+ %16 = struct $Int64 (%13 : $Builtin.Int64), loc "file.swift":2:15, scope 1
26
24
// In addition to checking if `op_fragment` is generated, we're also checking if "z"'s declared
27
25
// source location, as well as `debug_value`'s instruction source location are preserved.
28
- // CHECK: debug_value %[[RESULT]] : $Builtin.Int{{[0-9]+}} , let, name "z"
29
- // CHECK-SAME: type $Int
30
- // CHECK-SAME: expr op_fragment:#Int ._value
26
+ // CHECK: debug_value %[[RESULT]] : $Builtin.Int64 , let, name "z"
27
+ // CHECK-SAME: type $Int64
28
+ // CHECK-SAME: expr op_fragment:#Int64 ._value
31
29
// CHECK-SAME: loc "file.swift":2:9, scope 1
32
- debug_value %16 : $Int , let, name "z", loc "file.swift":2:9, scope 1
33
- %19 = struct_extract %16 : $Int , #Int ._value, loc "file.swift":3:14, scope 1
34
- %20 = struct_extract %1 : $Int , #Int ._value, loc "file.swift":3:14, scope 1
30
+ debug_value %16 : $Int64 , let, name "z", loc "file.swift":2:9, scope 1
31
+ %19 = struct_extract %16 : $Int64 , #Int64 ._value, loc "file.swift":3:14, scope 1
32
+ %20 = struct_extract %1 : $Int64 , #Int64 ._value, loc "file.swift":3:14, scope 1
35
33
%21 = integer_literal $Builtin.Int1, -1, loc "file.swift":3:14, scope 1
36
34
%22 = builtin "sadd_with_overflow_Int64"(%19 : $Builtin.Int64, %20 : $Builtin.Int64, %21 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1), loc "file.swift":3:14, scope 1
37
35
(%23, %24) = destructure_tuple %22 : $(Builtin.Int64, Builtin.Int1), loc "file.swift":3:14, scope 1
38
- %26 = struct $Int (%23 : $Builtin.Int64), loc "file.swift":3:14, scope 1
39
- return %26 : $Int , loc "file.swift":3:5, scope 1
36
+ %26 = struct $Int64 (%23 : $Builtin.Int64), loc "file.swift":3:14, scope 1
37
+ return %26 : $Int64 , loc "file.swift":3:5, scope 1
40
38
} // end sil function 'foo'
41
39
40
+ sil_scope 2 { loc "file.swift":1:6 parent @bar : $@convention(thin) (Int64, Int64) -> Int64 }
41
+
42
+ // Test if debug_value got preserved when %5 is folded into %0, and %3 removed
43
+ // CHECK-LABEL: sil {{.*}} @bar
44
+ sil hidden @bar : $@convention(thin) (Int64, Int64) -> Int64 {
45
+ bb0(%0 : $Int64, %1 : $Int64):
46
+ %3 = tuple $(low: Int64, high: Int64) (%0, %1), loc "file.swift":14:5, scope 2
47
+ // CHECK: debug_value %0 : $Int64, let, name "newValue"
48
+ // CHECK-SAME: type $(low: Int64, high: Int64)
49
+ // CHECK-SAME: expr op_tuple_fragment:$(low: Int64, high: Int64):0
50
+ // CHECK-SAME: "file.swift":14:5, scope 2
51
+ // CHECK: debug_value %1 : $Int64, let, name "newValue"
52
+ // CHECK-SAME: type $(low: Int64, high: Int64)
53
+ // CHECK-SAME: expr op_tuple_fragment:$(low: Int64, high: Int64):1
54
+ // CHECK-SAME: "file.swift":14:5, scope 2
55
+ debug_value %3 : $(low: Int64, high: Int64), let, name "newValue", argno 1, loc "file.swift":14:5, scope 2
56
+ (%5, %6) = destructure_tuple %3 : $(low: Int64, high: Int64), loc "file.swift":15:5, scope 2
57
+ return %5 : $Int64, loc "file.swift":15:5, scope 2
58
+ } // end sil function 'bar'
0 commit comments