mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #72479 from meg-gupta/fixsilcombineagain
Fix SILCombine of inject_enum_addr to correctly check for unreferenceable storage
This commit is contained in:
@@ -2009,3 +2009,21 @@ SILValue swift::createEmptyAndUndefValue(SILType ty,
|
||||
assert(!noUndef);
|
||||
return SILUndef::get(insertionPoint->getFunction(), ty);
|
||||
}
|
||||
|
||||
bool swift::findUnreferenceableStorage(StructDecl *decl, SILType structType,
|
||||
SILFunction *func) {
|
||||
if (decl->hasUnreferenceableStorage()) {
|
||||
return true;
|
||||
}
|
||||
// Check if any fields have unreferenceable stoage
|
||||
for (auto *field : decl->getStoredProperties()) {
|
||||
TypeExpansionContext tec = *func;
|
||||
auto fieldTy = structType.getFieldType(field, func->getModule(), tec);
|
||||
if (auto *fieldStructDecl = fieldTy.getStructOrBoundGenericStruct()) {
|
||||
if (findUnreferenceableStorage(fieldStructDecl, fieldTy, func)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user