File tree Expand file tree Collapse file tree 5 files changed +17
-5
lines changed
SwiftCompilerSources/Sources
lib/SILOptimizer/PassManager Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -643,8 +643,12 @@ extension Function {
643643 return nil
644644 }
645645
646+ /// True if this function has a dynamic-self metadata argument and any instruction is type dependent on it.
646647 var mayBindDynamicSelf : Bool {
647- self . bridged. mayBindDynamicSelf ( )
648+ guard let dynamicSelf = self . dynamicSelfMetadata else {
649+ return false
650+ }
651+ return dynamicSelf. uses. contains { $0. isTypeDependent }
648652 }
649653}
650654
Original file line number Diff line number Diff line change @@ -278,6 +278,13 @@ extension Function {
278278
279279 public var selfArgument : FunctionArgument { arguments [ selfArgumentIndex] }
280280
281+ public var dynamicSelfMetadata : FunctionArgument ? {
282+ if bridged. hasDynamicSelfMetadata ( ) {
283+ return arguments. last!
284+ }
285+ return nil
286+ }
287+
281288 public var argumentTypes : ArgumentTypeArray { ArgumentTypeArray ( function: self ) }
282289
283290 public var resultType : Type { bridged. getSILResultType ( ) . type }
Original file line number Diff line number Diff line change @@ -622,7 +622,7 @@ struct BridgedFunction {
622622 BRIDGED_INLINE bool isGeneric () const ;
623623 BRIDGED_INLINE bool hasSemanticsAttr (BridgedStringRef attrName) const ;
624624 BRIDGED_INLINE bool hasUnsafeNonEscapableResult () const ;
625- bool mayBindDynamicSelf () const ;
625+ BRIDGED_INLINE bool hasDynamicSelfMetadata () const ;
626626 BRIDGED_INLINE EffectsKind getEffectAttribute () const ;
627627 BRIDGED_INLINE PerformanceConstraints getPerformanceConstraints () const ;
628628 BRIDGED_INLINE InlineStrategy getInlineStrategy () const ;
Original file line number Diff line number Diff line change @@ -687,6 +687,10 @@ bool BridgedFunction::hasUnsafeNonEscapableResult() const {
687687 return getFunction ()->hasUnsafeNonEscapableResult ();
688688}
689689
690+ bool BridgedFunction::hasDynamicSelfMetadata () const {
691+ return getFunction ()->hasDynamicSelfMetadata ();
692+ }
693+
690694BridgedFunction::EffectsKind BridgedFunction::getEffectAttribute () const {
691695 return (EffectsKind)getFunction ()->getEffectsKind ();
692696}
Original file line number Diff line number Diff line change @@ -1591,9 +1591,6 @@ SwiftPassInvocation::~SwiftPassInvocation() {}
15911591// ===----------------------------------------------------------------------===//
15921592// SIL Bridging
15931593// ===----------------------------------------------------------------------===//
1594- bool BridgedFunction::mayBindDynamicSelf () const {
1595- return swift::mayBindDynamicSelf (getFunction ());
1596- }
15971594
15981595bool BridgedFunction::isTrapNoReturn () const {
15991596 return swift::isTrapNoReturnFunction (getFunction ());
You can’t perform that action at this time.
0 commit comments