File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
lib/SILOptimizer/Analysis Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -3345,8 +3345,8 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
33453345
33463346 auto storage = AccessStorageWithBase::compute (svi->getOperand (0 ));
33473347 if (storage.storage ) {
3348- if (isa <RefElementAddrInst>(storage.base )) {
3349- auto *nomDecl = storage. storage . getRoot ()
3348+ if (auto *reai = dyn_cast <RefElementAddrInst>(storage.base )) {
3349+ auto *nomDecl = reai-> getOperand ()
33503350 ->getType ()
33513351 .getNominalOrBoundGenericNominal ();
33523352 iter.first ->getSecond ().mergeIsolationRegionInfo (
Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ import _Concurrency
1919// MARK: Declarations //
2020////////////////////////
2121
22+ class Klass {}
23+
2224class NonSendableKlass {
25+ var klass: Klass
26+
2327 func asyncCall() async
2428}
2529
@@ -353,3 +357,21 @@ bb0:
353357 return %38 : $()
354358}
355359
360+ // Make sure that when we process the following sil we do not crash.
361+ //
362+ // We previously crashed since we used the base of the storage instead of the
363+ // operand of the root (the ref_element_addr)
364+ sil [ossa] @test_ref_element_addr_with_different_storage_no_crash : $@convention(method) <Self where Self : NonSendableKlass> (@guaranteed Self) -> () {
365+ bb0(%0 : @guaranteed $Self):
366+ %1 = copy_value %0 : $Self
367+ %2 = upcast %1 : $Self to $NonSendableKlass
368+ %3 = begin_borrow %2 : $NonSendableKlass
369+ %4 = ref_element_addr [immutable] %3 : $NonSendableKlass, #NonSendableKlass.klass
370+ %5 = load [copy] %4 : $*Klass
371+ destroy_value %5 : $Klass
372+ end_borrow %3 : $NonSendableKlass
373+ destroy_value %2 : $NonSendableKlass
374+ %9999 = tuple ()
375+ return %9999 : $()
376+ }
377+
You can’t perform that action at this time.
0 commit comments