Skip to content

Commit 31f3102

Browse files
committed
swift SIL: fix Function.isGeneric
It didn't work for functions in generic contexts, which don't add a generic parameter themselves
1 parent 3b239b2 commit 31f3102

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ReleaseDevirtualizer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private func tryDevirtualizeRelease(
108108
let functionRef = builder.createFunctionRef(dealloc)
109109

110110
let substitutionMap: SubstitutionMap
111-
if dealloc.isGenericFunction {
111+
if dealloc.isGeneric {
112112
substitutionMap = context.getContextSubstitutionMap(for: type)
113113
} else {
114114
// In embedded Swift, dealloc might be a specialized deinit, so the substitution map on the old apply isn't valid for the new apply

SwiftCompilerSources/Sources/Optimizer/ModulePasses/MandatoryPerformanceOptimizations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ fileprivate struct FunctionWorklist {
351351
}
352352

353353
mutating func addAllNonGenericFunctions(of moduleContext: ModulePassContext) {
354-
for f in moduleContext.functions where !f.isGenericFunction {
354+
for f in moduleContext.functions where !f.isGeneric {
355355
pushIfNotVisited(f)
356356
}
357357
return

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
166166

167167
public var isDestructor: Bool { bridged.isDestructor() }
168168

169-
public var isGenericFunction: Bool { bridged.isGenericFunction() }
169+
public var isGeneric: Bool { bridged.isGeneric() }
170170

171171
/// Kinds of effect attributes which can be defined for a Swift function.
172172
public enum EffectAttribute {

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ struct BridgedFunction {
529529
BRIDGED_INLINE bool isGlobalInitFunction() const;
530530
BRIDGED_INLINE bool isGlobalInitOnceFunction() const;
531531
BRIDGED_INLINE bool isDestructor() const;
532-
BRIDGED_INLINE bool isGenericFunction() const;
532+
BRIDGED_INLINE bool isGeneric() const;
533533
BRIDGED_INLINE bool hasSemanticsAttr(BridgedStringRef attrName) const;
534534
BRIDGED_INLINE bool hasUnsafeNonEscapableResult() const;
535535
BRIDGED_INLINE bool hasResultDependsOnSelf() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ bool BridgedFunction::isDestructor() const {
620620
return false;
621621
}
622622

623-
bool BridgedFunction::isGenericFunction() const {
624-
return !getFunction()->getGenericSignature().isNull();
623+
bool BridgedFunction::isGeneric() const {
624+
return getFunction()->isGeneric();
625625
}
626626

627627
bool BridgedFunction::hasSemanticsAttr(BridgedStringRef attrName) const {

0 commit comments

Comments
 (0)