| // RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s |
| |
| // Make sure that we are able to lower upcast addresses. |
| |
| // CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc %T6upcast1CC* @upcast_test(%T6upcast1DC** nocapture dereferenceable({{.*}}) %0) {{.*}} { |
| // CHECK: entry: |
| // CHECK-NEXT: [[A:%[0-9]+]] = bitcast %T6upcast1DC** {{%[0-0]+}} to %T6upcast1CC** |
| // CHECK-NEXT: [[C:%[0-9]+]] = load %T6upcast1CC*, %T6upcast1CC** [[A]] |
| // CHECK-NEXT: ret %T6upcast1CC* [[C]] |
| |
| class C {} |
| sil_vtable C {} |
| class D : C {} |
| sil_vtable D {} |
| |
| sil @upcast_test : $@convention(thin) (@inout D) -> C { |
| bb0(%0 : $*D): |
| %1 = upcast %0 : $*D to $*C |
| %2 = load %1 : $*C |
| return %2 : $C |
| } |