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.f...@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; } } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits