[SILOptimizer] Add prespecialization for arbitray reference types (#58846)

* [SILOptimizer] Add prespecialization for arbitray reference types

* Fix benchmark Package.swift

* Move SimpleArray to utils

* Fix multiple indirect result case

* Remove leftover code from previous attempt

* Fix test after rebase

* Move code to compute type replacements to SpecializedFunction

* Fix ownership when OSSA is enabled

* Fixes after rebase

* Changes after rebasing

* Add feature flag for layout pre-specialization

* Fix pre_specialize-macos.swift

* Add compiler flag to benchmark build

* Fix benchmark SwiftPM flags
This commit is contained in:
Dario Rexin
2022-09-22 16:29:01 -07:00
committed by GitHub
parent 6b586b6afd
commit 210c68d8aa
45 changed files with 1199 additions and 180 deletions

View File

@@ -82,6 +82,7 @@ public:
static SILSpecializeAttr *create(SILModule &M,
GenericSignature specializedSignature,
ArrayRef<Type> typeErasedParams,
bool exported, SpecializationKind kind,
SILFunction *target, Identifier spiGroup,
const ModuleDecl *spiModule,
@@ -107,6 +108,14 @@ public:
return specializedSignature;
}
GenericSignature getUnerasedSpecializedSignature() const {
return unerasedSpecializedSignature;
}
ArrayRef<Type> getTypeErasedParams() const {
return typeErasedParams;
}
SILFunction *getFunction() const {
return F;
}
@@ -133,6 +142,8 @@ private:
SpecializationKind kind;
bool exported;
GenericSignature specializedSignature;
GenericSignature unerasedSpecializedSignature;
llvm::SmallVector<Type, 2> typeErasedParams;
Identifier spiGroup;
AvailabilityContext availability;
const ModuleDecl *spiModule = nullptr;
@@ -140,8 +151,11 @@ private:
SILFunction *targetFunction = nullptr;
SILSpecializeAttr(bool exported, SpecializationKind kind,
GenericSignature specializedSignature, SILFunction *target,
Identifier spiGroup, const ModuleDecl *spiModule,
GenericSignature specializedSignature,
GenericSignature unerasedSpecializedSignature,
ArrayRef<Type> typeErasedParams,
SILFunction *target, Identifier spiGroup,
const ModuleDecl *spiModule,
AvailabilityContext availability);
};