mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
PMO: Don't block pmo for large types - rather only block expansion of tuples
This commit is contained in:
@@ -49,9 +49,6 @@
|
||||
|
||||
using namespace swift;
|
||||
|
||||
static llvm::cl::opt<bool> EnableExpandAll("enable-expand-all",
|
||||
llvm::cl::init(false));
|
||||
|
||||
static llvm::cl::opt<bool> KeepWillThrowCall(
|
||||
"keep-will-throw-call", llvm::cl::init(false),
|
||||
llvm::cl::desc(
|
||||
@@ -1269,32 +1266,6 @@ bool swift::simplifyUsers(SingleValueInstruction *inst) {
|
||||
return changed;
|
||||
}
|
||||
|
||||
// True if a type can be expanded without a significant increase to code size.
|
||||
//
|
||||
// False if expanding a type is invalid. For example, expanding a
|
||||
// struct-with-deinit drops the deinit.
|
||||
bool swift::shouldExpand(SILModule &module, SILType ty) {
|
||||
// FIXME: Expansion
|
||||
auto expansion = TypeExpansionContext::minimal();
|
||||
|
||||
if (module.Types.getTypeLowering(ty, expansion).isAddressOnly()) {
|
||||
return false;
|
||||
}
|
||||
// A move-only-with-deinit type cannot be SROA.
|
||||
//
|
||||
// TODO: we could loosen this requirement if all paths lead to a drop_deinit.
|
||||
if (auto *nominalTy = ty.getNominalOrBoundGenericNominal()) {
|
||||
if (nominalTy->getValueTypeDestructor())
|
||||
return false;
|
||||
}
|
||||
if (EnableExpandAll) {
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned numFields = module.Types.countNumberOfFields(ty, expansion);
|
||||
return (numFields <= 6);
|
||||
}
|
||||
|
||||
/// Some support functions for the global-opt and let-properties-opts
|
||||
|
||||
// Encapsulate the state used for recursive analysis of a static
|
||||
|
||||
Reference in New Issue
Block a user