You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix isTriviallyDuplicatable to handle open_pack_element
SILInstruction::clone doesn't know how to clone instructions that produce
the archetype uuid. SILCloner is equipped to handle such instructions.
Optimizations like LoopRotate use SILInstruction::clone and will be
incorrect for such instructions.
rdar://130047619
Copy file name to clipboardExpand all lines: test/SILOptimizer/looprotate.sil
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -465,3 +465,39 @@ bb3:
465
465
%1 = tuple ()
466
466
return %1 : $()
467
467
}
468
+
469
+
struct Wrapper : Sendable {
470
+
let id: Int
471
+
}
472
+
473
+
// CHECK-LABEL: sil @test_open_pack_element :
474
+
// CHECK: bb0{{.*}}:
475
+
// CHECK-NOT: open_pack_element
476
+
// CHECK: br bb2
477
+
// CHECK: } // end sil function 'test_open_pack_element'
478
+
sil @test_open_pack_element : $@convention(thin) (@pack_guaranteed Pack{KeyPath<Wrapper, Wrapper>}) -> () {
479
+
bb0(%0 : $*Pack{KeyPath<Wrapper, Wrapper>}):
480
+
%5 = alloc_stack $KeyPath<Wrapper, Wrapper>
481
+
%6 = integer_literal $Builtin.Word, 0 // user: %8
482
+
br bb2(%6 : $Builtin.Word)
483
+
484
+
bb1:
485
+
dealloc_stack %5 : $*KeyPath<Wrapper, Wrapper>
486
+
%35 = tuple ()
487
+
return %35 : $()
488
+
489
+
bb2(%37 : $Builtin.Word):
490
+
%38 = dynamic_pack_index %37 of $Pack{KeyPath<Wrapper, Wrapper>}
491
+
%39 = open_pack_element %38 of <Topic, each Value where Topic : AnyObject, repeat each Value : Sendable> at <Wrapper, Pack{Wrapper}>, shape $each Value, uuid "94218A22-3595-11EF-8496-4EA2A866E4C5"
492
+
%40 = pack_element_get %38 of %0 : $*Pack{KeyPath<Wrapper, Wrapper>} as $*KeyPath<Wrapper, @pack_element("94218A22-3595-11EF-8496-4EA2A866E4C5") each Value>
493
+
%41 = unchecked_addr_cast %5 : $*KeyPath<Wrapper, Wrapper> to $*KeyPath<Wrapper, @pack_element("94218A22-3595-11EF-8496-4EA2A866E4C5") each Value>
494
+
%42 = load %40 : $*KeyPath<Wrapper, @pack_element("94218A22-3595-11EF-8496-4EA2A866E4C5") each Value>
495
+
store %42 to %41 : $*KeyPath<Wrapper, @pack_element("94218A22-3595-11EF-8496-4EA2A866E4C5") each Value>
0 commit comments