Skip to content

Commit d03493b

Browse files
test: Fix test/IRGen/moveonly_value_functions.sil for 32-bit targets
We cannot assume Int is backed by BuiltIn.Int64 and ptr offset is i64.
1 parent a5ac6aa commit d03493b

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

test/IRGen/moveonly_value_functions.sil

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,40 @@ import Swift
1414
@_alwaysEmitIntoClient @inlinable deinit
1515
}
1616

17-
sil @$sSp12deinitialize5countSvSi_tF : $@convention(method) <τ_0_0 where τ_0_0 : ~Copyable> (Int, UnsafeMutablePointer<τ_0_0>) -> UnsafeMutableRawPointer
17+
sil @f : $@convention(method) <τ_0_0 where τ_0_0 : ~Copyable> (Builtin.Int64, UnsafeMutablePointer<τ_0_0>) -> UnsafeMutableRawPointer
1818

19-
// CHECK-LABEL: define{{.*}} @"$s15Synchronization5_CellVAARi_zrlEfD"(
19+
// CHECK-LABEL: define{{.*}} @g(
2020
// CHECK-SAME: ptr %"_Cell<Value>",
2121
// CHECK-SAME: ptr noalias swiftself [[SOURCE:%[0-9]+]]
2222
// CHECK-SAME: )
2323
// CHECK-SAME: {
2424
// CHECK: entry:
25-
// CHECK: [[CELL_VWT_ADDR:%[^,]+]] = getelementptr inbounds ptr, ptr %"_Cell<Value>", i64 -1
25+
// CHECK: [[CELL_VWT_ADDR:%[^,]+]] = getelementptr inbounds ptr, ptr %"_Cell<Value>", [[INT]] -1
2626
// CHECK: %"_Cell<Value>.valueWitnesses" = load ptr, ptr [[CELL_VWT_ADDR]]
2727
// CHECK: [[CELL_SIZE_ADDR:%[^,]+]] = getelementptr inbounds %swift.vwtable, ptr %"_Cell<Value>.valueWitnesses", i32 0, i32 8
28-
// CHECK: %size = load i64, ptr [[CELL_SIZE_ADDR]]
29-
// CHECK: [[DEST:%[^,]+]] = alloca i8, i64 %size
28+
// CHECK: %size = load [[INT]], ptr [[CELL_SIZE_ADDR]]
29+
// CHECK: [[DEST:%[^,]+]] = alloca i8, [[INT]] %size
3030
// CHECK: call void @llvm.lifetime.start.p0(i64 -1, ptr [[DEST]])
31-
// CHECK: [[VALUE_METADATA_ADDR:%[^,]+]] = getelementptr inbounds ptr, ptr %"_Cell<Value>", i64 2
31+
// CHECK: [[VALUE_METADATA_ADDR:%[^,]+]] = getelementptr inbounds ptr, ptr %"_Cell<Value>", [[INT]] 2
3232
// CHECK: %Value = load ptr, ptr [[VALUE_METADATA_ADDR]]
33-
// CHECK: [[VALUE_VWT_ADDR:%[^,]+]] = getelementptr inbounds ptr, ptr %Value, i64 -1
33+
// CHECK: [[VALUE_VWT_ADDR:%[^,]+]] = getelementptr inbounds ptr, ptr %Value, [[INT]] -1
3434
// CHECK: %Value.valueWitnesses = load ptr, ptr [[VALUE_VWT_ADDR]]
3535
// CHECK: [[VALUE_INIT_WITH_TAKE_ADDR:%[^,]+]] = getelementptr inbounds ptr, ptr %Value.valueWitnesses, i32 4
3636
// CHECK: %InitializeWithTake = load ptr, ptr [[VALUE_INIT_WITH_TAKE_ADDR]]
3737
// CHECK: call ptr %InitializeWithTake(ptr noalias [[DEST]], ptr noalias [[SOURCE]], ptr %Value)
38-
// CHECK: call swiftcc ptr @"$sSp12deinitialize5countSvSi_tF"(i64 1, ptr [[DEST]], ptr %Value)
38+
// CHECK: call swiftcc ptr @f(i64 1, ptr [[DEST]], ptr %Value)
3939
// CHECK: call void @llvm.lifetime.end.p0(i64 -1, ptr [[DEST]])
4040
// CHECK: }
41-
sil @$s15Synchronization5_CellVAARi_zrlEfD : $@convention(method) <Value where Value : ~Copyable> (@in _Cell<Value>) -> () {
41+
sil @g : $@convention(method) <Value where Value : ~Copyable> (@in _Cell<Value>) -> () {
4242
bb0(%0 : $*_Cell<Value>):
4343
%1 = alloc_stack $_Cell<Value>
4444
copy_addr [take] %0 to [init] %1 : $*_Cell<Value>
4545
%7 = builtin "addressOfRawLayout"<_Cell<Value>>(%1 : $*_Cell<Value>) : $Builtin.RawPointer
4646
%8 = struct $UnsafeMutablePointer<Value> (%7 : $Builtin.RawPointer)
4747
%9 = integer_literal $Builtin.Int64, 1
48-
%10 = struct $Int (%9 : $Builtin.Int64)
49-
%11 = function_ref @$sSp12deinitialize5countSvSi_tF : $@convention(method) <τ_0_0 where τ_0_0 : ~Copyable> (Int, UnsafeMutablePointer<τ_0_0>) -> UnsafeMutableRawPointer
50-
%12 = apply %11<Value>(%10, %8) : $@convention(method) <τ_0_0 where τ_0_0 : ~Copyable> (Int, UnsafeMutablePointer<τ_0_0>) -> UnsafeMutableRawPointer
51-
%13 = tuple ()
48+
%10 = function_ref @f : $@convention(method) <τ_0_0 where τ_0_0 : ~Copyable> (Builtin.Int64, UnsafeMutablePointer<τ_0_0>) -> UnsafeMutableRawPointer
49+
%11 = apply %10<Value>(%9, %8) : $@convention(method) <τ_0_0 where τ_0_0 : ~Copyable> (Builtin.Int64, UnsafeMutablePointer<τ_0_0>) -> UnsafeMutableRawPointer
50+
%12 = tuple ()
5251
dealloc_stack %1 : $*_Cell<Value>
53-
return %13 : $()
52+
return %12 : $()
5453
}

0 commit comments

Comments
 (0)