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(
3345
3345
3346
3346
auto storage = AccessStorageWithBase::compute (svi->getOperand (0 ));
3347
3347
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 ()
3350
3350
->getType ()
3351
3351
.getNominalOrBoundGenericNominal ();
3352
3352
iter.first ->getSecond ().mergeIsolationRegionInfo (
Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ import _Concurrency
19
19
// MARK: Declarations //
20
20
////////////////////////
21
21
22
+ class Klass {}
23
+
22
24
class NonSendableKlass {
25
+ var klass: Klass
26
+
23
27
func asyncCall() async
24
28
}
25
29
@@ -353,3 +357,21 @@ bb0:
353
357
return %38 : $()
354
358
}
355
359
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