17
17
// ===----------------------------------------------------------------------===//
18
18
19
19
#define DEBUG_TYPE " loadable-address"
20
- #include " Explosion.h"
21
20
#include " FixedTypeInfo.h"
22
21
#include " IRGenMangler.h"
23
22
#include " IRGenModule.h"
@@ -3432,29 +3431,6 @@ class AddressAssignment {
3432
3431
toDeleteBlockArg.push_back (std::make_pair (b, argIdx));
3433
3432
}
3434
3433
3435
- bool isPotentiallyCArray (SILType ty) {
3436
- if (ty.isAddress () || ty.isClassOrClassMetatype ()) {
3437
- return false ;
3438
- }
3439
-
3440
- auto canType = ty.getASTType ();
3441
- if (canType->hasTypeParameter ()) {
3442
- assert (genEnv && " Expected a GenericEnv" );
3443
- canType = genEnv->mapTypeIntoContext (canType)->getCanonicalType ();
3444
- }
3445
-
3446
- if (canType.getAnyGeneric () || isa<TupleType>(canType)) {
3447
- assert (ty.isObject () &&
3448
- " Expected only two categories: address and object" );
3449
- assert (!canType->hasTypeParameter ());
3450
- const TypeInfo &TI = irgenModule->getTypeInfoForLowered (canType);
3451
- auto explosionSchema = TI.getSchema ();
3452
- if (explosionSchema.size () > 15 )
3453
- return true ;
3454
- }
3455
- return false ;
3456
- }
3457
-
3458
3434
bool isLargeLoadableType (SILType ty) {
3459
3435
if (ty.isAddress () || ty.isClassOrClassMetatype ()) {
3460
3436
return false ;
@@ -3472,11 +3448,7 @@ class AddressAssignment {
3472
3448
assert (!canType->hasTypeParameter ());
3473
3449
const TypeInfo &TI = irgenModule->getTypeInfoForLowered (canType);
3474
3450
auto &nativeSchemaOrigParam = TI.nativeParameterValueSchema (*irgenModule);
3475
- if (nativeSchemaOrigParam.size () > 15 )
3476
- return true ;
3477
- auto explosionSchema = TI.getSchema ();
3478
- if (explosionSchema.size () > 15 )
3479
- return true ;
3451
+ return nativeSchemaOrigParam.size () > 15 ;
3480
3452
}
3481
3453
return false ;
3482
3454
}
@@ -3489,7 +3461,7 @@ class AddressAssignment {
3489
3461
auto it = valueToAddressMap.find (v);
3490
3462
3491
3463
// This can happen if we deem a container type small but a contained type
3492
- // big.
3464
+ // big or if we lower an undef value .
3493
3465
if (it == valueToAddressMap.end ()) {
3494
3466
if (auto *sv = dyn_cast<SingleValueInstruction>(v)) {
3495
3467
auto addr = createAllocStack (v->getType ());
@@ -3499,6 +3471,11 @@ class AddressAssignment {
3499
3471
mapValueToAddress (v, addr);
3500
3472
return addr;
3501
3473
}
3474
+ if (isa<SILUndef>(v)) {
3475
+ auto undefAddr = createAllocStack (v->getType ());
3476
+ mapValueToAddress (v, undefAddr);
3477
+ return undefAddr;
3478
+ }
3502
3479
}
3503
3480
assert (it != valueToAddressMap.end ());
3504
3481
@@ -3794,6 +3771,7 @@ class AssignAddressToDef : SILInstructionVisitor<AssignAddressToDef> {
3794
3771
StoreOwnershipQualifier::Unqualified);
3795
3772
assignment.mapValueToAddress (origValue, addr);
3796
3773
assignment.markForDeletion (bc);
3774
+
3797
3775
return ;
3798
3776
}
3799
3777
auto opdAddr = assignment.getAddressForValue (bc->getOperand ());
@@ -3955,9 +3933,7 @@ class RewriteUser : SILInstructionVisitor<RewriteUser> {
3955
3933
}
3956
3934
3957
3935
void visitDebugValueInst (DebugValueInst *dbg) {
3958
- if (!dbg->hasAddrVal () &&
3959
- (assignment.isPotentiallyCArray (dbg->getOperand ()->getType ()) ||
3960
- overlapsWithOnStackDebugLoc (dbg->getOperand ()))) {
3936
+ if (!dbg->hasAddrVal () && overlapsWithOnStackDebugLoc (dbg->getOperand ())) {
3961
3937
assignment.markForDeletion (dbg);
3962
3938
return ;
3963
3939
}
0 commit comments