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 {
643
643
return nil
644
644
}
645
645
646
+ /// True if this function has a dynamic-self metadata argument and any instruction is type dependent on it.
646
647
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 }
648
652
}
649
653
}
650
654
Original file line number Diff line number Diff line change @@ -278,6 +278,13 @@ extension Function {
278
278
279
279
public var selfArgument : FunctionArgument { arguments [ selfArgumentIndex] }
280
280
281
+ public var dynamicSelfMetadata : FunctionArgument ? {
282
+ if bridged. hasDynamicSelfMetadata ( ) {
283
+ return arguments. last!
284
+ }
285
+ return nil
286
+ }
287
+
281
288
public var argumentTypes : ArgumentTypeArray { ArgumentTypeArray ( function: self ) }
282
289
283
290
public var resultType : Type { bridged. getSILResultType ( ) . type }
Original file line number Diff line number Diff line change @@ -622,7 +622,7 @@ struct BridgedFunction {
622
622
BRIDGED_INLINE bool isGeneric () const ;
623
623
BRIDGED_INLINE bool hasSemanticsAttr (BridgedStringRef attrName) const ;
624
624
BRIDGED_INLINE bool hasUnsafeNonEscapableResult () const ;
625
- bool mayBindDynamicSelf () const ;
625
+ BRIDGED_INLINE bool hasDynamicSelfMetadata () const ;
626
626
BRIDGED_INLINE EffectsKind getEffectAttribute () const ;
627
627
BRIDGED_INLINE PerformanceConstraints getPerformanceConstraints () const ;
628
628
BRIDGED_INLINE InlineStrategy getInlineStrategy () const ;
Original file line number Diff line number Diff line change @@ -687,6 +687,10 @@ bool BridgedFunction::hasUnsafeNonEscapableResult() const {
687
687
return getFunction ()->hasUnsafeNonEscapableResult ();
688
688
}
689
689
690
+ bool BridgedFunction::hasDynamicSelfMetadata () const {
691
+ return getFunction ()->hasDynamicSelfMetadata ();
692
+ }
693
+
690
694
BridgedFunction::EffectsKind BridgedFunction::getEffectAttribute () const {
691
695
return (EffectsKind)getFunction ()->getEffectsKind ();
692
696
}
Original file line number Diff line number Diff line change @@ -1591,9 +1591,6 @@ SwiftPassInvocation::~SwiftPassInvocation() {}
1591
1591
// ===----------------------------------------------------------------------===//
1592
1592
// SIL Bridging
1593
1593
// ===----------------------------------------------------------------------===//
1594
- bool BridgedFunction::mayBindDynamicSelf () const {
1595
- return swift::mayBindDynamicSelf (getFunction ());
1596
- }
1597
1594
1598
1595
bool BridgedFunction::isTrapNoReturn () const {
1599
1596
return swift::isTrapNoReturnFunction (getFunction ());
You can’t perform that action at this time.
0 commit comments