[llvm-branch-commits] [llvm] [Linker] Remove a use of StructType::setBody. NFC. (PR #116653)
Jay Foad via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 18 08:42:04 PST 2024
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/116653
This falls out naturally after inlining finishType into its only remaining use.
>From 4140bc772f5930807cb2ea5b4b2aa945c57b699c Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Mon, 18 Nov 2024 16:36:33 +0000
Subject: [PATCH] [Linker] Remove a use of StructType::setBody. NFC.
This falls out naturally after inlining finishType into its only
remaining use.
---
llvm/lib/Linker/IRMover.cpp | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index c653900c632cc9..4bb0ddf891744b 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -82,8 +82,6 @@ class TypeMapTy : public ValueMapTypeRemapper {
Type *get(Type *SrcTy);
Type *get(Type *SrcTy, SmallPtrSet<StructType *, 8> &Visited);
- void finishType(StructType *DTy, StructType *STy, ArrayRef<Type *> ETypes);
-
FunctionType *get(FunctionType *T) {
return cast<FunctionType>(get((Type *)T));
}
@@ -233,20 +231,6 @@ Error TypeMapTy::linkDefinedTypeBodies() {
return Error::success();
}
-void TypeMapTy::finishType(StructType *DTy, StructType *STy,
- ArrayRef<Type *> ETypes) {
- DTy->setBody(ETypes, STy->isPacked());
-
- // Steal STy's name.
- if (STy->hasName()) {
- SmallString<16> TmpName = STy->getName();
- STy->setName("");
- DTy->setName(TmpName);
- }
-
- DstStructTypesSet.addNonOpaque(DTy);
-}
-
Type *TypeMapTy::get(Type *Ty) {
SmallPtrSet<StructType *, 8> Visited;
return get(Ty, Visited);
@@ -342,8 +326,17 @@ Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
return *Entry = Ty;
}
- StructType *DTy = StructType::create(Ty->getContext());
- finishType(DTy, STy, ElementTypes);
+ StructType *DTy =
+ StructType::create(Ty->getContext(), ElementTypes, "", STy->isPacked());
+
+ // Steal STy's name.
+ if (STy->hasName()) {
+ SmallString<16> TmpName = STy->getName();
+ STy->setName("");
+ DTy->setName(TmpName);
+ }
+
+ DstStructTypesSet.addNonOpaque(DTy);
return *Entry = DTy;
}
}
More information about the llvm-branch-commits
mailing list