@@ -177,39 +177,6 @@ IRFunc* specializeDispatchFunction(
177
177
return newDispatchFunc;
178
178
}
179
179
180
- // Returns true if the witness table is transitively referenced through a witness table with
181
- // linkage.
182
- bool _isWitnessTableTransitivelyVisible (IRInst* witness)
183
- {
184
- if (witness->findDecoration <IRLinkageDecoration>())
185
- return true ;
186
-
187
- OrderedHashSet<IRInst*> workSet;
188
- List<IRInst*> workList;
189
- workList.add (witness);
190
- for (int i = 0 ; i < workList.getCount (); i++)
191
- {
192
- auto item = workList[i];
193
- if (item->findDecoration <IRLinkageDecoration>())
194
- return true ;
195
- for (auto use = item->firstUse ; use; use = use->nextUse )
196
- {
197
- auto user = use->getUser ();
198
- if (user->getOp () == kIROp_WitnessTableEntry )
199
- {
200
- if (user->getParent ())
201
- {
202
- if (workSet.add (user->getParent ()))
203
- {
204
- workList.add (user->getParent ());
205
- }
206
- }
207
- }
208
- }
209
- }
210
- return false ;
211
- }
212
-
213
180
// Ensures every witness table object has been assigned a sequential ID.
214
181
// All witness tables will have a SequentialID decoration after this function is run.
215
182
// The sequantial ID in the decoration will be the same as the one specified in the Linkage.
@@ -242,27 +209,15 @@ void ensureWitnessTableSequentialIDs(SharedGenericsLoweringContext* sharedContex
242
209
continue ;
243
210
}
244
211
245
- // If this witness table entry does not have a linkage,
246
- // we need to check if it is transitively visible via
247
- // associatedtypes from an existing witness table with linkage.
248
- // If so we still need to include this witness talbe, otherwise
249
- // don't assign sequential ID for it.
250
- if (_isWitnessTableTransitivelyVisible (inst))
212
+ // generate a unique linkage for it.
213
+ static int32_t uniqueId = 0 ;
214
+ uniqueId++;
215
+ if (auto nameHint = inst->findDecoration <IRNameHintDecoration>())
251
216
{
252
- // generate a unique linkage for it.
253
- static int32_t uniqueId = 0 ;
254
- uniqueId++;
255
- if (auto nameHint = inst->findDecoration <IRNameHintDecoration>())
256
- {
257
- generatedMangledName << nameHint->getName ();
258
- }
259
- generatedMangledName << " _generated_witness_uuid_" << uniqueId;
260
- witnessTableMangledName = generatedMangledName.getUnownedSlice ();
261
- }
262
- else
263
- {
264
- continue ;
217
+ generatedMangledName << nameHint->getName ();
265
218
}
219
+ generatedMangledName << " _generated_witness_uuid_" << uniqueId;
220
+ witnessTableMangledName = generatedMangledName.getUnownedSlice ();
266
221
}
267
222
268
223
// If the inst already has a SequentialIDDecoration, stop now.
0 commit comments