File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,13 @@ bool ValueBase::isLexical() const {
153153 return bbi->isLexical ();
154154 if (auto *mvi = dyn_cast<MoveValueInst>(this ))
155155 return mvi->isLexical ();
156+
157+ // TODO: This is only a workaround. Optimizations should look through such instructions to
158+ // get the isLexical state, instead of doing it here.
159+ // rdar://143577158
160+ if (auto *eilr = dyn_cast<EndInitLetRefInst>(this ))
161+ return eilr->getOperand ()->isLexical ();
162+
156163 return false ;
157164}
158165
Original file line number Diff line number Diff line change @@ -1071,3 +1071,24 @@ sil [ossa] @dontShortenDeadMoveOnlyLifetime : $@convention(thin) () -> () {
10711071 %retval = tuple ()
10721072 return %retval : $()
10731073}
1074+
1075+ // CHECK-LABEL: sil [ossa] @look_through_end_init_let_ref :
1076+ // CHECK: [[E:%.*]] = end_init_let_ref
1077+ // CHECK: [[D:%.*]] = function_ref @dummy
1078+ // CHECK: apply [[D]]
1079+ // CHECK: destroy_value [[E]]
1080+ // CHECK-LABEL: } // end sil function 'look_through_end_init_let_ref'
1081+ sil [ossa] @look_through_end_init_let_ref : $@convention(thin) () -> () {
1082+ bb0:
1083+ %0 = alloc_ref $C
1084+ %1 = move_value [lexical] %0
1085+ %2 = end_init_let_ref %1
1086+ %4 = function_ref @takeGuaranteedC : $@convention(thin) (@guaranteed C) -> ()
1087+ apply %4(%2) : $@convention(thin) (@guaranteed C) -> ()
1088+ %6 = function_ref @dummy : $@convention(thin) () -> ()
1089+ apply %6() : $@convention(thin) () -> ()
1090+ destroy_value %2
1091+ %3 = tuple ()
1092+ return %3
1093+ }
1094+
You can’t perform that action at this time.
0 commit comments