Skip to content

Commit ccb9ca1

Browse files
committed
Re-apply some fixes
1 parent 29da947 commit ccb9ca1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3461,7 +3461,7 @@ class AddressAssignment {
34613461
auto it = valueToAddressMap.find(v);
34623462

34633463
// This can happen if we deem a container type small but a contained type
3464-
// big.
3464+
// big or if we lower an undef value.
34653465
if (it == valueToAddressMap.end()) {
34663466
if (auto *sv = dyn_cast<SingleValueInstruction>(v)) {
34673467
auto addr = createAllocStack(v->getType());
@@ -3471,6 +3471,11 @@ class AddressAssignment {
34713471
mapValueToAddress(v, addr);
34723472
return addr;
34733473
}
3474+
if (isa<SILUndef>(v)) {
3475+
auto undefAddr = createAllocStack(v->getType());
3476+
mapValueToAddress(v, undefAddr);
3477+
return undefAddr;
3478+
}
34743479
}
34753480
assert(it != valueToAddressMap.end());
34763481

@@ -3765,6 +3770,7 @@ class AssignAddressToDef : SILInstructionVisitor<AssignAddressToDef> {
37653770
builder.createStore(bc->getLoc(), bc->getOperand(), opdAddr,
37663771
StoreOwnershipQualifier::Unqualified);
37673772
assignment.mapValueToAddress(origValue, addr);
3773+
assignment.markForDeletion(bc);
37683774

37693775
return;
37703776
}

0 commit comments

Comments
 (0)