mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Swift Optimizer: simplification for apply, try_apply, begin_apply and partial_apply
* move the apply of partial_apply transformation from simplify-apply to simplify-partial_apply * delete dead partial_apply instructions * devirtualize apply, try_apply and begin_apply
This commit is contained in:
@@ -202,7 +202,17 @@ struct BridgedPassContext {
|
||||
block.getBlock()->eraseFromParent();
|
||||
}
|
||||
|
||||
bool tryDeleteDeadClosure(BridgedInstruction closure) const;
|
||||
bool tryOptimizeApplyOfPartialApply(BridgedInstruction closure) const;
|
||||
|
||||
bool tryDeleteDeadClosure(BridgedInstruction closure, bool needKeepArgsAlive) const;
|
||||
|
||||
struct DevirtResult {
|
||||
OptionalBridgedInstruction newApply;
|
||||
bool cfgChanged;
|
||||
};
|
||||
|
||||
SWIFT_IMPORT_UNSAFE
|
||||
DevirtResult tryDevirtualizeApply(BridgedInstruction apply, bool isMandatory) const;
|
||||
|
||||
SWIFT_IMPORT_UNSAFE
|
||||
OptionalBridgedValue constantFoldBuiltin(BridgedInstruction builtin) const;
|
||||
|
||||
@@ -69,7 +69,8 @@ SubstitutionMap getWitnessMethodSubstitutions(SILModule &Module, ApplySite AI,
|
||||
/// Return the new apply and true if the CFG was also modified.
|
||||
std::pair<ApplySite, bool>
|
||||
tryDevirtualizeApply(ApplySite AI, ClassHierarchyAnalysis *CHA,
|
||||
OptRemark::Emitter *ORE = nullptr);
|
||||
OptRemark::Emitter *ORE = nullptr,
|
||||
bool isMandatory = false);
|
||||
bool canDevirtualizeApply(FullApplySite AI, ClassHierarchyAnalysis *CHA);
|
||||
bool canDevirtualizeClassMethod(FullApplySite AI, ClassDecl *CD,
|
||||
OptRemark::Emitter *ORE = nullptr,
|
||||
@@ -108,7 +109,9 @@ tryDevirtualizeClassMethod(FullApplySite AI, SILValue ClassInstance,
|
||||
/// the original apply site.
|
||||
///
|
||||
/// Return the new apply and true if the CFG was also modified.
|
||||
std::pair<ApplySite, bool> tryDevirtualizeWitnessMethod(ApplySite AI, OptRemark::Emitter *ORE);
|
||||
std::pair<ApplySite, bool> tryDevirtualizeWitnessMethod(ApplySite AI,
|
||||
OptRemark::Emitter *ORE,
|
||||
bool isMandatory);
|
||||
|
||||
/// Delete a successfully-devirtualized apply site. This must always be
|
||||
/// called after devirtualizing an apply; not only is it not semantically
|
||||
|
||||
Reference in New Issue
Block a user