[llvm] c6915cd - [IRMover] Remove Visited set in type mapping (NFC) (#137329)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 08:16:16 PDT 2025
Author: Nikita Popov
Date: 2025-04-25T17:16:12+02:00
New Revision: c6915cd3ed17b6c658393c37d8df5f3af5b79c61
URL: https://github.com/llvm/llvm-project/commit/c6915cd3ed17b6c658393c37d8df5f3af5b79c61
DIFF: https://github.com/llvm/llvm-project/commit/c6915cd3ed17b6c658393c37d8df5f3af5b79c61.diff
LOG: [IRMover] Remove Visited set in type mapping (NFC) (#137329)
LLVM no longer supports recursive types, so the Visited set is
unnecessary.
Added:
Modified:
llvm/lib/Linker/IRMover.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 26a9a161a8fd7..98d69051c935a 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -80,7 +80,6 @@ class TypeMapTy : public ValueMapTypeRemapper {
/// Return the mapped type to use for the specified input type from the
/// source module.
Type *get(Type *SrcTy);
- Type *get(Type *SrcTy, SmallPtrSet<StructType *, 8> &Visited);
FunctionType *get(FunctionType *T) {
return cast<FunctionType>(get((Type *)T));
@@ -232,11 +231,6 @@ Error TypeMapTy::linkDefinedTypeBodies() {
}
Type *TypeMapTy::get(Type *Ty) {
- SmallPtrSet<StructType *, 8> Visited;
- return get(Ty, Visited);
-}
-
-Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
// If we already have an entry for this type, return it.
Type **Entry = &MappedTypes[Ty];
if (*Entry)
@@ -252,11 +246,6 @@ Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
"mapping to a source type");
}
#endif
-
- if (!Visited.insert(cast<StructType>(Ty)).second) {
- StructType *DTy = StructType::create(Ty->getContext());
- return *Entry = DTy;
- }
}
// 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) {
bool AnyChange = false;
ElementTypes.resize(Ty->getNumContainedTypes());
for (unsigned I = 0, E = Ty->getNumContainedTypes(); I != E; ++I) {
- ElementTypes[I] = get(Ty->getContainedType(I), Visited);
+ ElementTypes[I] = get(Ty->getContainedType(I));
AnyChange |= ElementTypes[I] != Ty->getContainedType(I);
}
More information about the llvm-commits
mailing list