Skip to content

Commit c6915cd

Browse files
authored
[IRMover] Remove Visited set in type mapping (NFC) (llvm#137329)
LLVM no longer supports recursive types, so the Visited set is unnecessary.
1 parent 9062a38 commit c6915cd

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

llvm/lib/Linker/IRMover.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class TypeMapTy : public ValueMapTypeRemapper {
8080
/// Return the mapped type to use for the specified input type from the
8181
/// source module.
8282
Type *get(Type *SrcTy);
83-
Type *get(Type *SrcTy, SmallPtrSet<StructType *, 8> &Visited);
8483

8584
FunctionType *get(FunctionType *T) {
8685
return cast<FunctionType>(get((Type *)T));
@@ -232,11 +231,6 @@ Error TypeMapTy::linkDefinedTypeBodies() {
232231
}
233232

234233
Type *TypeMapTy::get(Type *Ty) {
235-
SmallPtrSet<StructType *, 8> Visited;
236-
return get(Ty, Visited);
237-
}
238-
239-
Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
240234
// If we already have an entry for this type, return it.
241235
Type **Entry = &MappedTypes[Ty];
242236
if (*Entry)
@@ -252,11 +246,6 @@ Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
252246
"mapping to a source type");
253247
}
254248
#endif
255-
256-
if (!Visited.insert(cast<StructType>(Ty)).second) {
257-
StructType *DTy = StructType::create(Ty->getContext());
258-
return *Entry = DTy;
259-
}
260249
}
261250

262251
// If this is not a recursive type, then just map all of the elements and
@@ -272,7 +261,7 @@ Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
272261
bool AnyChange = false;
273262
ElementTypes.resize(Ty->getNumContainedTypes());
274263
for (unsigned I = 0, E = Ty->getNumContainedTypes(); I != E; ++I) {
275-
ElementTypes[I] = get(Ty->getContainedType(I), Visited);
264+
ElementTypes[I] = get(Ty->getContainedType(I));
276265
AnyChange |= ElementTypes[I] != Ty->getContainedType(I);
277266
}
278267

0 commit comments

Comments
 (0)