Skip to content

Commit ec0a2d8

Browse files
committed
[IRGen] Eliminate reliance on witness markers from PolymorphicConvention.
We need only gather type metadata from type parameters that are canonical, so do so directly rather than filtering out witness markers.
1 parent 7d038c4 commit ec0a2d8

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -200,29 +200,16 @@ void PolymorphicConvention::addPseudogenericFulfillments() {
200200
void PolymorphicConvention::enumerateRequirements(const RequirementCallback &callback) {
201201
if (!Generics) return;
202202

203-
// Make a first pass to get all the type metadata.
204-
for (auto &reqt : Generics->getRequirements()) {
205-
switch (reqt.getKind()) {
206-
// Ignore these; they don't introduce extra requirements.
207-
case RequirementKind::Superclass:
208-
case RequirementKind::SameType:
209-
case RequirementKind::Conformance:
210-
continue;
211-
212-
case RequirementKind::WitnessMarker: {
213-
CanType type = CanType(reqt.getFirstType());
214-
if (isa<GenericTypeParamType>(type))
215-
callback({type, nullptr});
216-
continue;
217-
}
218-
}
219-
llvm_unreachable("bad requirement kind");
203+
// Get all of the type metadata.
204+
for (auto gp : Generics.getGenericParams()) {
205+
if (Generics->getCanonicalTypeInContext(gp, M) == gp)
206+
callback({gp, nullptr});
220207
}
221208

222-
// Make a second pass for all the protocol conformances.
209+
// Get the protocol conformances.
223210
for (auto &reqt : Generics->getRequirements()) {
224211
switch (reqt.getKind()) {
225-
// Ignore these; they don't introduce extra requirements.
212+
// Ignore these; they don't introduce extra requirements.
226213
case RequirementKind::Superclass:
227214
case RequirementKind::SameType:
228215
case RequirementKind::WitnessMarker:

0 commit comments

Comments
 (0)