Skip to content

Commit 3dd9682

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents d6c3623 + 1f05436 commit 3dd9682

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lib/SILOptimizer/Mandatory/AddressLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ SILInstruction *AddressLoweringState::getLatestOpeningInst(SILType ty) const {
14811481
if (!archetype)
14821482
return;
14831483

1484-
if (auto openedTy = getOpenedArchetypeOf(archetype)) {
1484+
if (auto openedTy = getLocalArchetypeOf(archetype)) {
14851485
auto openingVal =
14861486
getModule()->getRootLocalArchetypeDef(openedTy, function);
14871487

test/SILOptimizer/address_lowering.sil

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,6 +2524,28 @@ bb0:
25242524
return %retval : $()
25252525
}
25262526

2527+
// CHECK-LABEL: sil [ossa] @test_open_pack_element_dominance : $@convention(thin) <each T> (@pack_guaranteed Pack{repeat each T}, Builtin.Word) -> () {
2528+
// CHECK: bb0([[PACK:%[^,]+]] :
2529+
// CHECK-SAME: [[RAW_INDEX:%[^,]+]] :
2530+
// CHECK: [[INDEX:%[^,]+]] = dynamic_pack_index [[RAW_INDEX]]
2531+
// CHECK: open_pack_element [[INDEX]] {{.*}}, uuid "00000000-0000-0000-0000-000000000003"
2532+
// CHECK: [[STACK:%[^,]+]] = alloc_stack $@pack_element("00000000-0000-0000-0000-000000000003")
2533+
// CHECK: [[ELEMENT_ADDR:%[^,]+]] = pack_element_get [[INDEX]] of [[PACK]]
2534+
// CHECK: copy_addr [[ELEMENT_ADDR]] to [init] [[STACK]]
2535+
// CHECK: destroy_addr [[STACK]]
2536+
// CHECK: dealloc_stack [[STACK]]
2537+
// CHECK-LABEL: } // end sil function 'test_open_pack_element_dominance'
2538+
sil [ossa] @test_open_pack_element_dominance : $@convention(thin) <each T> (@pack_guaranteed Pack{repeat each T}, Builtin.Word) -> () {
2539+
bb0(%pack : $*Pack{repeat each T}, %raw_index : $Builtin.Word):
2540+
%index = dynamic_pack_index %raw_index of $Pack{repeat each T}
2541+
open_pack_element %index of <each T> at <Pack{repeat each T}>, shape $each T, uuid "00000000-0000-0000-0000-000000000003"
2542+
%element_addr = pack_element_get %index of %pack : $*Pack{repeat each T} as $*@pack_element("00000000-0000-0000-0000-000000000003") each T
2543+
%element = load [copy] %element_addr : $*@pack_element("00000000-0000-0000-0000-000000000003") each T
2544+
destroy_value %element : $@pack_element("00000000-0000-0000-0000-000000000003") each T
2545+
%retval = tuple ()
2546+
return %retval : $()
2547+
}
2548+
25272549
// CHECK-LABEL: sil [ossa] @test_partial_apply_1_addronly_heap : {{.*}} {
25282550
// CHECK: [[STACK:%[^,]+]] = alloc_stack $T
25292551
// CHECK: [[GET:%[^,]+]] = function_ref @getT

0 commit comments

Comments
 (0)