@@ -89,7 +89,7 @@ public enum Pass {
8989 /// This pass converts SwitchInst instructions into a sequence of chained
9090 /// binary branch instructions.
9191 case lowerSwitch
92- /// This pass is used to promote memory references to
92+ /// This pass is used to promote memory references to
9393 /// be register references. A simple example of the transformation performed
9494 /// by this pass is going from code like this:
9595 ///
@@ -120,10 +120,6 @@ public enum Pass {
120120 case reassociate
121121 /// Sparse conditional constant propagation.
122122 case sccp
123- /// Replace aggregates or pieces of aggregates with scalar SSA values.
124- case scalarReplAggregates
125- /// Replace aggregates or pieces of aggregates with scalar SSA values.
126- case scalarReplAggregatesSSA
127123 /// This pass eliminates call instructions to the current function which occur
128124 /// immediately before return instructions.
129125 case tailCallElimination
@@ -186,6 +182,8 @@ public enum Pass {
186182 /// Return a new pass object which transforms invoke instructions into calls,
187183 /// if the callee can *not* unwind the stack.
188184 case pruneEH
185+
186+ case scalarReplacementOfAggregates
189187 /// This pass removes any function declarations (prototypes) that are not used.
190188 case stripDeadPrototypes
191189 /// These functions removes symbols from functions and modules without
@@ -197,6 +195,17 @@ public enum Pass {
197195 /// This pass performs a superword-level parallelism pass to combine
198196 /// similar independent instructions into vector instructions.
199197 case slpVectorize
198+ /// An invalid pass that crashes when added to the pass manager.
199+ case invalid( reason: String )
200+ }
201+
202+ extension Pass {
203+ @available ( * , deprecated, message: " Pass has been removed " )
204+ static let simplifyLibCalls : Pass = . invalid( reason: " Pass has been removed " )
205+ @available ( * , deprecated, message: " Use the scalarReplacementOfAggregates instead " )
206+ static let scalarReplAggregates : Pass = . invalid( reason: " Pass has been renamed to 'scalarReplacementOfAggregates' " )
207+ @available ( * , deprecated, message: " Use the scalarReplacementOfAggregates instead " )
208+ static let scalarReplAggregatesSSA : Pass = . invalid( reason: " Pass has been renamed to 'scalarReplacementOfAggregates' " )
200209}
201210
202211/// A `FunctionPassManager` is an object that collects a sequence of passes
@@ -205,6 +214,7 @@ public enum Pass {
205214@available ( * , deprecated, message: " Use the PassPipeliner instead " )
206215public class FunctionPassManager {
207216 internal let llvm : LLVMPassManagerRef
217+ var alivePassObjects = [ Any] ( )
208218
209219 /// Creates a `FunctionPassManager` bound to the given module's IR.
210220 public init ( module: Module ) {
@@ -218,7 +228,7 @@ public class FunctionPassManager {
218228 /// list of passes to run.
219229 public func add( _ passes: Pass ... ) {
220230 for pass in passes {
221- PassPipeliner . passMapping [ pass ] ! ( llvm)
231+ PassPipeliner . configurePass ( pass , passManager : llvm, keepalive : & alivePassObjects )
222232 }
223233 }
224234
0 commit comments