File tree Expand file tree Collapse file tree 2 files changed +31
-21
lines changed
SwiftCompilerSources/Sources/Optimizer Expand file tree Collapse file tree 2 files changed +31
-21
lines changed Original file line number Diff line number Diff line change @@ -394,27 +394,6 @@ private extension InstructionWorklist {
394394 }
395395}
396396
397- private extension Value {
398- /// Returns true if this value is a valid in a static initializer, including all its operands.
399- var isValidGlobalInitValue : Bool {
400- guard let svi = self as? SingleValueInstruction else {
401- return false
402- }
403- if let beginAccess = svi as? BeginAccessInst {
404- return beginAccess. address. isValidGlobalInitValue
405- }
406- if !svi. isValidInStaticInitializerOfGlobal {
407- return false
408- }
409- for op in svi. operands {
410- if !op. value. isValidGlobalInitValue {
411- return false
412- }
413- }
414- return true
415- }
416- }
417-
418397private extension AllocRefInstBase {
419398 var fieldsKnownStatically : Bool {
420399 if let allocDynamic = self as? AllocRefDynamicInst ,
Original file line number Diff line number Diff line change @@ -131,6 +131,37 @@ extension Value {
131131 }
132132 return builder. createCopyValue ( operand: self )
133133 }
134+
135+ /// True if this value is a valid in a static initializer, including all its operands.
136+ var isValidGlobalInitValue : Bool {
137+ guard let svi = self as? SingleValueInstruction else {
138+ return false
139+ }
140+ if let beginAccess = svi as? BeginAccessInst {
141+ return beginAccess. address. isValidGlobalInitValue
142+ }
143+ if !svi. isValidInStaticInitializerOfGlobal {
144+ return false
145+ }
146+ for op in svi. operands {
147+ if !op. value. isValidGlobalInitValue {
148+ return false
149+ }
150+ }
151+ return true
152+ }
153+ }
154+
155+ extension FullApplySite {
156+ func isSemanticCall( _ name: StaticString , withArgumentCount: Int ) -> Bool {
157+ if arguments. count == withArgumentCount,
158+ let callee = referencedFunction,
159+ callee. hasSemanticsAttribute ( name)
160+ {
161+ return true
162+ }
163+ return false
164+ }
134165}
135166
136167extension Builder {
You can’t perform that action at this time.
0 commit comments