File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ class SILBuilder {
424
424
}
425
425
426
426
LoadInst *createLoad (SILLocation Loc, SILValue LV) {
427
+ assert (LV->getType ().isLoadable (F.getModule ()));
427
428
return insert (new (F.getModule ())
428
429
LoadInst (getSILDebugLocation (Loc), LV));
429
430
}
Original file line number Diff line number Diff line change @@ -1426,6 +1426,11 @@ optimizeBridgedObjCToSwiftCast(SILInstruction *Inst,
1426
1426
assert (Src->getType ().isAddress () && " Source should have an address type" );
1427
1427
assert (Dest->getType ().isAddress () && " Source should have an address type" );
1428
1428
1429
+ if (!Src->getType ().isLoadable (M) || !Dest->getType ().isLoadable (M)) {
1430
+ // TODO: Handle address only types.
1431
+ return nullptr ;
1432
+ }
1433
+
1429
1434
if (SILBridgedTy != Src->getType ()) {
1430
1435
// Check if we can simplify a cast into:
1431
1436
// - ObjCTy to _ObjectiveCBridgeable._ObjectiveCType.
@@ -1603,6 +1608,11 @@ optimizeBridgedSwiftToObjCCast(SILInstruction *Inst,
1603
1608
1604
1609
auto &M = Inst->getModule ();
1605
1610
auto Loc = Inst->getLoc ();
1611
+
1612
+ if (!Src->getType ().isLoadable (M) || !Dest->getType ().isLoadable (M)) {
1613
+ // TODO: Handle address-only types.
1614
+ return nullptr ;
1615
+ }
1606
1616
1607
1617
// Find the _BridgedToObjectiveC protocol.
1608
1618
auto BridgedProto =
You can’t perform that action at this time.
0 commit comments