Skip to content

Commit db694d1

Browse files
committed
Optimizer: re-implement the RedundantLoadElimination pass in Swift
The new implementation has several benefits compared to the old C++ implementation: * It is significantly simpler. It optimizes each load separately instead of all at once with bit-field based dataflow. * It's using alias analysis more accurately which enables more loads to be optimized * It avoids inserting additional copies in OSSA The algorithm is a data flow analysis which starts at the original load and searches for preceding stores or loads by following the control flow in backward direction. The preceding stores and loads provide the "available values" with which the original load can be replaced.
1 parent 9250367 commit db694d1

18 files changed

+841
-1993
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ swift_compiler_sources(Optimizer
1717
ObjCBridgingOptimization.swift
1818
MergeCondFails.swift
1919
NamedReturnValueOptimization.swift
20+
RedundantLoadElimination.swift
2021
ReleaseDevirtualizer.swift
2122
SimplificationPasses.swift
2223
StackPromotion.swift

0 commit comments

Comments
 (0)