Skip to content

Commit dc8d482

Browse files
committed
SILOptimizer: extract predictable access and dead alloc optimizations into stand-alone utility functions
1 parent 7c28d7a commit dc8d482

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

include/swift/SILOptimizer/Utils/InstOptUtils.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,16 @@ bool tryEliminateOnlyOwnershipUsedForwardingInst(
719719
IntegerLiteralInst *optimizeBuiltinCanBeObjCClass(BuiltinInst *bi,
720720
SILBuilder &builder);
721721

722+
/// Performs "predictable" memory access optimizations.
723+
///
724+
/// See the PredictableMemoryAccessOptimizations pass.
725+
bool optimizeMemoryAccesses(SILFunction &fn);
726+
727+
/// Performs "predictable" dead allocation optimizations.
728+
///
729+
/// See the PredictableDeadAllocationElimination pass.
730+
bool eliminateDeadAllocations(SILFunction &fn);
731+
722732
} // end namespace swift
723733

724734
#endif

lib/SILOptimizer/Mandatory/PredictableMemOpt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,7 +2846,7 @@ static AllocationInst *getOptimizableAllocation(SILInstruction *i) {
28462846
return alloc;
28472847
}
28482848

2849-
static bool optimizeMemoryAccesses(SILFunction &fn) {
2849+
bool swift::optimizeMemoryAccesses(SILFunction &fn) {
28502850
bool changed = false;
28512851
DeadEndBlocks deadEndBlocks(&fn);
28522852

@@ -2887,7 +2887,7 @@ static bool optimizeMemoryAccesses(SILFunction &fn) {
28872887
return changed;
28882888
}
28892889

2890-
static bool eliminateDeadAllocations(SILFunction &fn) {
2890+
bool swift::eliminateDeadAllocations(SILFunction &fn) {
28912891
bool changed = false;
28922892
DeadEndBlocks deadEndBlocks(&fn);
28932893

0 commit comments

Comments
 (0)