Skip to content

Revert "[opt] remove trivially dead instructions in mandatory combine" #31077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/SILOptimizer/Mandatory/MandatoryCombine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ void MandatoryCombiner::addReachableCodeToWorklist(SILFunction &function) {
++iterator;

if (isInstructionTriviallyDead(instruction)) {
instModCallbacks.deleteInst(instruction);
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// IRGen test.

// RUN: %target-swift-frontend -emit-ir -Xllvm -sil-disable-pass=MandatoryCombine %s | %FileCheck %s --check-prefix=IRGEN --check-prefix %target-cpu
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=IRGEN --check-prefix %target-cpu
// NOTE: `%target-cpu`-specific FileCheck lines exist because lowered function types in LLVM IR differ between architectures.

// NOTE(SR-12090): `shell` is required only to run `sed` as a SR-12090 workaround.
Expand Down
2 changes: 1 addition & 1 deletion test/ClangImporter/macro_literals.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xllvm -sil-print-debuginfo -Xllvm -sil-disable-pass=MandatoryCombine -emit-sil %s | %FileCheck %s
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -Xllvm -sil-print-debuginfo -emit-sil %s | %FileCheck %s

import macros

Expand Down
17 changes: 7 additions & 10 deletions test/Constraints/keypath_dynamic_member_lookup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,17 @@ var bottomRight = Point(x: 10, y: 10)
var lens = Lens(Rectangle(topLeft: topLeft,
bottomRight: bottomRight))

// A dummy user of variables.
func user<T>(_ _: T) {}

// CHECK: function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs15WritableKeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply %45<Rectangle, Point>({{.*}})
// CHECK: function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs7KeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply %54<Point, Int>({{.*}})
user(lens.topLeft.x)
_ = lens.topLeft.x

// CHECK: [[LOOKUP_REF1:%.*]] = function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs15WritableKeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply [[LOOKUP_REF1]]<Rectangle, Point>({{.*}})
// CHECK: [[LOOKUP_REF2:%.*]] = function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs15WritableKeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply [[LOOKUP_REF2]]<Point, Int>({{.*}})
user(lens.topLeft.y)
// CHECK: function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs15WritableKeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply %69<Rectangle, Point>({{.*}})
// CHECK: function_ref @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs15WritableKeyPathCyxqd__G_tcluig
// CHECK-NEXT: apply %76<Point, Int>({{.*}})
_ = lens.topLeft.y

lens.topLeft = Lens(Point(x: 1, y: 2)) // Ok
lens.bottomRight.y = Lens(12) // Ok
Expand Down Expand Up @@ -241,7 +238,7 @@ func test_recursive_dynamic_lookup(_ lens: Lens<Lens<Point>>) {
// CHECK: [[FIRST_OBJ:%.*]] = struct_extract {{.*}} : $Lens<Lens<Point>>, #Lens.obj
// CHECK-NEXT: [[SECOND_OBJ:%.*]] = struct_extract [[FIRST_OBJ]] : $Lens<Point>, #Lens.obj
// CHECK-NEXT: struct_extract [[SECOND_OBJ]] : $Point, #Point.y
user(lens.obj.obj.y)
_ = lens.obj.obj.y
// CHECK: keypath $KeyPath<Point, Int>, (root $Point; stored_property #Point.x : $Int)
// CHECK-NEXT: keypath $KeyPath<Lens<Point>, Lens<Int>>, (root $Lens<Point>; gettable_property $Lens<Int>, id @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs7KeyPathCyxqd__G_tcluig : {{.*}})
// CHECK-NEXT: keypath $KeyPath<Lens<Lens<Point>>, Lens<Lens<Int>>>, (root $Lens<Lens<Point>>; gettable_property $Lens<Lens<Int>>, id @$s29keypath_dynamic_member_lookup4LensV0B6MemberACyqd__Gs7KeyPathCyxqd__G_tcluig : {{.*}})
Expand Down
6 changes: 0 additions & 6 deletions test/IRGen/access_markers.sil
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ bb0(%0 : $A):
// CHECK-NEXT: getelementptr inbounds %Ts5Int64V, %Ts5Int64V* [[PROPERTY]], i32 0, i32 0
// CHECK-NEXT: load i64, i64*
%4 = load %3 : $*Int64
// Use %4 so it's not optimized away.
// CHECK-NEXT: store
store %4 to undef : $*Int64

// CHECK-NEXT: call void @swift_endAccess([[BUFFER]]* [[SCRATCH1]])
// CHECK-NEXT: [[T0:%.*]] = bitcast [[BUFFER]]* [[SCRATCH1]] to i8*
Expand All @@ -51,9 +48,6 @@ bb0(%0 : $A):
// CHECK-NEXT: getelementptr inbounds %Ts5Int64V, %Ts5Int64V* [[PROPERTY]], i32 0, i32 0
// CHECK-NEXT: load i64, i64*
%7 = load %6 : $*Int64
// Use %7 so it's not optimized away.
// CHECK-NEXT: store
store %7 to undef : $*Int64

// CHECK-NEXT: call void @swift_endAccess([[BUFFER]]* [[SCRATCH2]])
// CHECK-NEXT: [[T0:%.*]] = bitcast [[BUFFER]]* [[SCRATCH2]] to i8*
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/dynamic_self.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=MandatoryCombine -emit-ir %s | %FileCheck %s
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s

// REQUIRES: CPU=i386 || CPU=x86_64

Expand Down
19 changes: 0 additions & 19 deletions test/IRGen/enum.sil
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ entry(%u : $*Singleton):
switch_enum_addr %u : $*Singleton, case #Singleton.value!enumelt: dest
dest:
%u2 = unchecked_take_enum_data_addr %u : $*Singleton, #Singleton.value!enumelt
// Use u2 so it's not optimized away.
copy_addr %u2 to undef : $*(Builtin.Int64, Builtin.Int64)
%x = tuple ()
return %x : $()
}
Expand Down Expand Up @@ -981,7 +979,6 @@ entry(%u : $*SinglePayloadSpareBit):
// CHECK-64: [[DATA_ADDR:%.*]] = bitcast %T4enum21SinglePayloadSpareBitO* %0 to i63*
x_dest:
%u2 = unchecked_take_enum_data_addr %u : $*SinglePayloadSpareBit, #SinglePayloadSpareBit.x!enumelt
copy_addr %u2 to undef : $*Builtin.Int63
%a = function_ref @a : $@convention(thin) () -> ()
apply %a() : $@convention(thin) () -> ()
br end
Expand Down Expand Up @@ -1492,20 +1489,14 @@ entry(%u : $*MultiPayloadNoSpareBits):

x_dest:
%x = unchecked_take_enum_data_addr %u : $*MultiPayloadNoSpareBits, #MultiPayloadNoSpareBits.x!enumelt
// Dummy use of %x so it's not optimized away.
copy_addr %x to undef : $*Builtin.Int64
br end

y_dest:
%y = unchecked_take_enum_data_addr %u : $*MultiPayloadNoSpareBits, #MultiPayloadNoSpareBits.y!enumelt
// Dummy use of %y so it's not optimized away.
copy_addr %y to undef : $*Builtin.Int32
br end

z_dest:
%z = unchecked_take_enum_data_addr %u : $*MultiPayloadNoSpareBits, #MultiPayloadNoSpareBits.z!enumelt
// Dummy use of %z so it's not optimized away.
copy_addr %z to undef : $*Builtin.Int63
br end

a_dest:
Expand Down Expand Up @@ -1751,20 +1742,14 @@ entry(%u : $*MultiPayloadOneSpareBit):

x_dest:
%x = unchecked_take_enum_data_addr %u : $*MultiPayloadOneSpareBit, #MultiPayloadOneSpareBit.x!enumelt
// Dummy use of %x so it's not optimized away.
copy_addr %x to undef : $*Builtin.Int62
br end

y_dest:
%y = unchecked_take_enum_data_addr %u : $*MultiPayloadOneSpareBit, #MultiPayloadOneSpareBit.y!enumelt
// Dummy use of %y so it's not optimized away.
copy_addr %y to undef : $*Builtin.Int63
br end

z_dest:
%z = unchecked_take_enum_data_addr %u : $*MultiPayloadOneSpareBit, #MultiPayloadOneSpareBit.z!enumelt
// Dummy use of %z so it's not optimized away.
copy_addr %z to undef : $*Builtin.Int61
br end

a_dest:
Expand Down Expand Up @@ -2456,8 +2441,6 @@ entry(%0 : $*DynamicSingleton<T>):

dest:
%1 = unchecked_take_enum_data_addr %0 : $*DynamicSingleton<T>, #DynamicSingleton.value!enumelt
// Dummy use of %1 so it's not optimized away.
copy_addr %1 to undef : $*T
%v = tuple ()
return %v : $()
}
Expand Down Expand Up @@ -2538,8 +2521,6 @@ entry(%x : $Int32):
// CHECK-64: [[INT_SHR:%.*]] = lshr i64 [[INT_SHL]], 32
// CHECK-64: [[INT:%.*]] = trunc i64 [[INT_SHR]] to i32
%e = unchecked_enum_data %d : $Optional<(Optional<()>, Int32)>, #Optional.some!enumelt
// Use %e so it's not optimized away.
store %e to undef : $*(Optional<()>, Int32)
return %d : $Optional<(Optional<()>, Int32)>
}

Expand Down
4 changes: 0 additions & 4 deletions test/IRGen/enum_dynamic_multi_payload.sil
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,8 @@ sil @dynamic_project : $@convention(thin) <T> () -> @out EitherOr<T, Builtin.Int
entry(%e : $*EitherOr<T, Builtin.Int64>):
// CHECK: bitcast [[EITHER_OR]]* %0 to %swift.opaque*
%l = unchecked_take_enum_data_addr %e : $*EitherOr<T, Builtin.Int64>, #EitherOr.Left!enumelt
// Dummy use of %l so that it's not optimized away.
copy_addr %l to undef : $*T
// CHECK: bitcast [[EITHER_OR]]* %0 to i64*
%r = unchecked_take_enum_data_addr %e : $*EitherOr<T, Builtin.Int64>, #EitherOr.Right!enumelt
// Dummy use of %r so that it's not optimized away.
copy_addr %r to undef : $*Builtin.Int64

return undef : $()
}
Expand Down
18 changes: 0 additions & 18 deletions test/IRGen/enum_future.sil
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ entry(%u : $*Singleton):
switch_enum_addr %u : $*Singleton, case #Singleton.value!enumelt: dest
dest:
%u2 = unchecked_take_enum_data_addr %u : $*Singleton, #Singleton.value!enumelt
copy_addr %u2 to undef : $*(Builtin.Int64, Builtin.Int64)
%x = tuple ()
return %x : $()
}
Expand Down Expand Up @@ -984,7 +983,6 @@ entry(%u : $*SinglePayloadSpareBit):
// CHECK-64: [[DATA_ADDR:%.*]] = bitcast %T11enum_future21SinglePayloadSpareBitO* %0 to i63*
x_dest:
%u2 = unchecked_take_enum_data_addr %u : $*SinglePayloadSpareBit, #SinglePayloadSpareBit.x!enumelt
copy_addr %u2 to undef : $*Builtin.Int63
%a = function_ref @a : $@convention(thin) () -> ()
apply %a() : $@convention(thin) () -> ()
br end
Expand Down Expand Up @@ -1495,20 +1493,14 @@ entry(%u : $*MultiPayloadNoSpareBits):

x_dest:
%x = unchecked_take_enum_data_addr %u : $*MultiPayloadNoSpareBits, #MultiPayloadNoSpareBits.x!enumelt
// Use %x so it's not optimized away.
copy_addr %x to undef : $*Builtin.Int64
br end

y_dest:
%y = unchecked_take_enum_data_addr %u : $*MultiPayloadNoSpareBits, #MultiPayloadNoSpareBits.y!enumelt
// Use %y so it's not optimized away.
copy_addr %y to undef : $*Builtin.Int32
br end

z_dest:
%z = unchecked_take_enum_data_addr %u : $*MultiPayloadNoSpareBits, #MultiPayloadNoSpareBits.z!enumelt
// Use %z so it's not optimized away.
copy_addr %z to undef : $*Builtin.Int63
br end

a_dest:
Expand Down Expand Up @@ -1754,20 +1746,14 @@ entry(%u : $*MultiPayloadOneSpareBit):

x_dest:
%x = unchecked_take_enum_data_addr %u : $*MultiPayloadOneSpareBit, #MultiPayloadOneSpareBit.x!enumelt
// Use %x so it's not optimized away.
copy_addr %x to undef : $*Builtin.Int62
br end

y_dest:
%y = unchecked_take_enum_data_addr %u : $*MultiPayloadOneSpareBit, #MultiPayloadOneSpareBit.y!enumelt
// Use %y so it's not optimized away.
copy_addr %y to undef : $*Builtin.Int63
br end

z_dest:
%z = unchecked_take_enum_data_addr %u : $*MultiPayloadOneSpareBit, #MultiPayloadOneSpareBit.z!enumelt
// Use %z so it's not optimized away.
copy_addr %z to undef : $*Builtin.Int61
br end

a_dest:
Expand Down Expand Up @@ -2459,8 +2445,6 @@ entry(%0 : $*DynamicSingleton<T>):

dest:
%1 = unchecked_take_enum_data_addr %0 : $*DynamicSingleton<T>, #DynamicSingleton.value!enumelt
// Use %1 so it's not optimized away.
copy_addr %1 to undef : $*T
%v = tuple ()
return %v : $()
}
Expand Down Expand Up @@ -2541,8 +2525,6 @@ entry(%x : $Int32):
// CHECK-64: [[INT_SHR:%.*]] = lshr i64 [[INT_SHL]], 32
// CHECK-64: [[INT:%.*]] = trunc i64 [[INT_SHR]] to i32
%e = unchecked_enum_data %d : $Optional<(Optional<()>, Int32)>, #Optional.some!enumelt
// Use %e so it's not optimized away.
store %e to undef : $*(Optional<()>, Int32)
return %d : $Optional<(Optional<()>, Int32)>
}

Expand Down
4 changes: 0 additions & 4 deletions test/IRGen/existentials.sil
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,12 @@ entry(%w : $*@sil_weak CP?, %a : $CP?):
// CHECK: [[SRC_WITNESS_ADDR:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 1
// CHECK: [[DEST_WITNESS:%.*]] = load i8**, i8*** [[SRC_WITNESS_ADDR]]
%b = load_weak [take] %w : $*@sil_weak CP?
// Use %b so it isn't removed.
store_weak %b to undef : $*@sil_weak CP?

// CHECK: [[SRC_REF_ADDR:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 0
// CHECK: [[DEST_REF:%.*]] = call %swift.refcounted* @swift_weakLoadStrong(%swift.weak* [[SRC_REF_ADDR]])
// CHECK: [[SRC_WITNESS_ADDR:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 1
// CHECK: [[DEST_WITNESS:%.*]] = load i8**, i8*** [[SRC_WITNESS_ADDR]]
%c = load_weak %w : $*@sil_weak CP?
// Use %c so it isn't removed.
store_weak %c to undef : $*@sil_weak CP?

// CHECK: call { %swift.weak, i8** }* @"$s12existentials2CP_pSgXwWOb"({ %swift.weak, i8** }* %0, { %swift.weak, i8** }* [[V]])
copy_addr [take] %w to [initialization] %v : $*@sil_weak CP?
Expand Down
4 changes: 0 additions & 4 deletions test/IRGen/existentials_objc.sil
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,12 @@ entry(%w : $*@sil_weak CP?, %a : $CP?):
// CHECK: [[SRC_WITNESS_ADDR:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 1
// CHECK: [[DEST_WITNESS:%.*]] = load i8**, i8*** [[SRC_WITNESS_ADDR]]
%b = load_weak [take] %w : $*@sil_weak CP?
// Use the value so it's not optimized away.
store_weak %b to undef : $*@sil_weak CP?

// CHECK: [[SRC_REF_ADDR:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 0
// CHECK: [[DEST_REF:%.*]] = call %objc_object* @swift_unknownObjectWeakLoadStrong(%swift.weak* [[SRC_REF_ADDR]])
// CHECK: [[SRC_WITNESS_ADDR:%.*]] = getelementptr inbounds { %swift.weak, i8** }, { %swift.weak, i8** }* %0, i32 0, i32 1
// CHECK: [[DEST_WITNESS:%.*]] = load i8**, i8*** [[SRC_WITNESS_ADDR]]
%c = load_weak %w : $*@sil_weak CP?
// Use the value so it's not optimized away.
store_weak %c to undef : $*@sil_weak CP?

// CHECK: call { %swift.weak, i8** }* @"$s17existentials_objc2CP_pSgXwWOb"({ %swift.weak, i8** }* %0, { %swift.weak, i8** }* [[V]])
copy_addr [take] %w to [initialization] %v : $*@sil_weak CP?
Expand Down
4 changes: 0 additions & 4 deletions test/IRGen/existentials_opaque_boxed.sil
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ entry:
sil @test_open_existential_addr_immutable :$@convention(thin) (@in Existential) -> () {
bb0(%0 : $*Existential):
%1 = open_existential_addr immutable_access %0 : $*Existential to $*@opened("01234567-89ab-cdef-0123-000000000000") Existential
// Use %1 so it's not optimized away.
copy_addr %1 to undef : $*@opened("01234567-89ab-cdef-0123-000000000000") Existential
%t = tuple()
return %t : $()
}
Expand Down Expand Up @@ -249,8 +247,6 @@ bb0(%0 : $*Existential):
sil @test_open_existential_addr_mutable :$@convention(thin) (@in Existential) -> () {
bb0(%0 : $*Existential):
%1 = open_existential_addr mutable_access %0 : $*Existential to $*@opened("01234567-89ab-cdef-0123-000000000001") Existential
// Use %1 so it's not optimized away.
copy_addr %1 to undef : $*@opened("01234567-89ab-cdef-0123-000000000001") Existential
%t = tuple()
return %t : $()
}
Expand Down
28 changes: 13 additions & 15 deletions test/IRGen/fixed_layout_class.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,23 @@
// This tests @_fixed_layout classes in resilient modules.
import fixed_layout_class

func blackHole<T>(_ _ : T) { }

// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s16class_resilience20useRootClassPropertyyy013fixed_layout_A0026OutsideParentWithResilientF0CF"(%T18fixed_layout_class34OutsideParentWithResilientPropertyC* %0)
public func useRootClassProperty(_ o: OutsideParentWithResilientProperty) {
// CHECK: getelementptr inbounds %T18fixed_layout_class34OutsideParentWithResilientPropertyC, %T18fixed_layout_class34OutsideParentWithResilientPropertyC* %0, i32 0, i32 1
blackHole(o.p)
_ = o.p
// CHECK: load [[INT]], [[INT]]* @"$s18fixed_layout_class34OutsideParentWithResilientPropertyC1s16resilient_struct4SizeVvpWvd"
blackHole(o.s)
_ = o.s
// CHECK: load [[INT]], [[INT]]* @"$s18fixed_layout_class34OutsideParentWithResilientPropertyC5colors5Int32VvpWvd"
blackHole(o.color)
_ = o.color
// CHECK: ret void
}

// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s16class_resilience19useSubclassPropertyyy013fixed_layout_A012OutsideChildCF"(%T18fixed_layout_class12OutsideChildC* %0)
public func useSubclassProperty(_ o: OutsideChild) {
// CHECK: getelementptr inbounds %T18fixed_layout_class13OutsideParentC, %T18fixed_layout_class13OutsideParentC* %6, i32 0, i32 1
blackHole(o.property)
// CHECK: getelementptr inbounds %T18fixed_layout_class13OutsideParentC, %T18fixed_layout_class13OutsideParentC* %4, i32 0, i32 1
_ = o.property
// CHECK: getelementptr inbounds %T18fixed_layout_class12OutsideChildC, %T18fixed_layout_class12OutsideChildC* %0, i32 0, i32 2
blackHole(o.childProperty)
_ = o.childProperty
// CHECK: ret void
}

Expand All @@ -49,15 +47,15 @@ public func useGenericRootClassProperty<A>(_ o: GenericOutsideParent<A>) {
// CHECK: [[FIELD_OFFSET_ADDR:%.*]] = getelementptr inbounds i8, i8* [[METADATA_ADDR]], [[INT]] [[FIELD_OFFSET_OFFSET]]
// CHECK: [[FIELD_OFFSET_PTR:%.*]] = bitcast i8* [[FIELD_OFFSET_ADDR]] to [[INT]]*
// CHECK: [[FIELD_OFFSET:%.*]] = load [[INT]], [[INT]]* [[FIELD_OFFSET_PTR]]
blackHole(o.property)
_ = o.property

// CHECK: ret void
}

// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s16class_resilience27useGenericRootClassPropertyyy013fixed_layout_A00D13OutsideParentCySiGF"(%T18fixed_layout_class20GenericOutsideParentCySiG* %0)
public func useGenericRootClassProperty(_ o: GenericOutsideParent<Int>) {
// CHECK: getelementptr inbounds %T18fixed_layout_class20GenericOutsideParentCySiG, %T18fixed_layout_class20GenericOutsideParentCySiG* %0, i32 0, i32 1
blackHole(o.property)
_ = o.property

// CHECK: ret void
}
Expand All @@ -80,7 +78,7 @@ public func useGenericSubclassProperty<A>(_ o: GenericOutsideChild<A>) {
// CHECK: [[FIELD_OFFSET_ADDR:%.*]] = getelementptr inbounds i8, i8* [[METADATA_ADDR]], [[INT]] [[FIELD_OFFSET_OFFSET]]
// CHECK: [[FIELD_OFFSET_PTR:%.*]] = bitcast i8* [[FIELD_OFFSET_ADDR]] to [[INT]]*
// CHECK: [[FIELD_OFFSET:%.*]] = load [[INT]], [[INT]]* [[FIELD_OFFSET_PTR]]
blackHole(o.property)
_ = o.property

// CHECK: [[METADATA_ADDR:%.*]] = getelementptr inbounds %T18fixed_layout_class19GenericOutsideChildC, %T18fixed_layout_class19GenericOutsideChildC* %0, i32 0, i32 0, i32 0
// CHECK: [[METADATA:%.*]] = load %swift.type*, %swift.type** [[METADATA_ADDR]]
Expand All @@ -92,7 +90,7 @@ public func useGenericSubclassProperty<A>(_ o: GenericOutsideChild<A>) {
// CHECK: [[FIELD_OFFSET_ADDR:%.*]] = getelementptr inbounds i8, i8* [[METADATA_ADDR]], [[INT]] [[FIELD_OFFSET_OFFSET]]
// CHECK: [[FIELD_OFFSET_PTR:%.*]] = bitcast i8* [[FIELD_OFFSET_ADDR]] to [[INT]]*
// CHECK: [[FIELD_OFFSET:%.*]] = load [[INT]], [[INT]]* [[FIELD_OFFSET_PTR]]
blackHole(o.childProperty)
_ = o.childProperty

// CHECK: ret void
}
Expand All @@ -101,10 +99,10 @@ public func useGenericSubclassProperty<A>(_ o: GenericOutsideChild<A>) {
public func useGenericSubclassProperty(_ o: GenericOutsideChild<Int>) {
// CHECK: [[UPCAST:%.*]] = bitcast %T18fixed_layout_class19GenericOutsideChildCySiG* %0 to %T18fixed_layout_class20GenericOutsideParentCySiG*
// CHECK: getelementptr inbounds %T18fixed_layout_class20GenericOutsideParentCySiG, %T18fixed_layout_class20GenericOutsideParentCySiG* [[UPCAST]], i32 0, i32 1
blackHole(o.property)
_ = o.property

// CHECK: getelementptr inbounds %T18fixed_layout_class19GenericOutsideChildCySiG, %T18fixed_layout_class19GenericOutsideChildCySiG* %0, i32 0, i32 2
blackHole(o.childProperty)
_ = o.childProperty

// CHECK: ret void
}
Expand All @@ -114,7 +112,7 @@ public func callVirtualMethod(_ o: OutsideParent) {
// Note: virtual method calls still use dispatch thunks

// CHECK: call swiftcc void @"$s18fixed_layout_class13OutsideParentC6methodyyFTj"
blackHole(o.method())
_ = o.method()

// CHECK: ret void
}
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/foreign_types.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=MandatoryCombine -disable-generic-metadata-prespecialization -I %S/Inputs/abi %s -emit-ir | %FileCheck %s -DINT=i%target-ptrsize
// RUN: %target-swift-frontend -disable-generic-metadata-prespecialization -I %S/Inputs/abi %s -emit-ir | %FileCheck %s -DINT=i%target-ptrsize

sil_stage canonical
import c_layout
Expand Down
Loading