@@ -50,7 +50,7 @@ private func optimizeFunctionsTopDown(using worklist: inout FunctionWorklist,
50
50
return
51
51
}
52
52
53
- optimize ( function: f, context, & worklist)
53
+ optimize ( function: f, context, & worklist, isEmbeddedSwift : moduleContext . options . enableEmbeddedSwift )
54
54
}
55
55
}
56
56
}
@@ -60,7 +60,7 @@ fileprivate struct PathFunctionTuple: Hashable {
60
60
var function : Function
61
61
}
62
62
63
- private func optimize( function: Function , _ context: FunctionPassContext , _ worklist: inout FunctionWorklist ) {
63
+ private func optimize( function: Function , _ context: FunctionPassContext , _ worklist: inout FunctionWorklist , isEmbeddedSwift : Bool ) {
64
64
var alreadyInlinedFunctions : Set < PathFunctionTuple > = Set ( )
65
65
66
66
var changed = true
@@ -75,12 +75,21 @@ private func optimize(function: Function, _ context: FunctionPassContext, _ work
75
75
switch instruction {
76
76
case let apply as FullApplySite :
77
77
inlineAndDevirtualize ( apply: apply, alreadyInlinedFunctions: & alreadyInlinedFunctions, context, simplifyCtxt)
78
+
79
+ // Embedded Swift specific transformations
78
80
case let alloc as AllocRefInst :
79
- specializeVTableAndAddEntriesToWorklist ( for: alloc. type, in: function, context, & worklist)
81
+ if isEmbeddedSwift {
82
+ specializeVTableAndAddEntriesToWorklist ( for: alloc. type, in: function, context, & worklist)
83
+ }
80
84
case let metatype as MetatypeInst :
81
- specializeVTableAndAddEntriesToWorklist ( for: metatype. type, in: function, context, & worklist)
85
+ if isEmbeddedSwift {
86
+ specializeVTableAndAddEntriesToWorklist ( for: metatype. type, in: function, context, & worklist)
87
+ }
82
88
case let classMethod as ClassMethodInst :
83
- _ = context. specializeClassMethodInst ( classMethod)
89
+ if isEmbeddedSwift {
90
+ _ = context. specializeClassMethodInst ( classMethod)
91
+ }
92
+
84
93
default :
85
94
break
86
95
}
0 commit comments