From 45a78e67db14783d352cbd57dbf6aca82f1649ab Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Wed, 12 Feb 2025 10:31:52 +0100 Subject: [PATCH] IRGen: remove `TypeInfo::allocateVector` It's not needed anymore because the alloc_vector instruction is removed. --- lib/IRGen/FixedTypeInfo.h | 2 -- lib/IRGen/GenArray.cpp | 6 ------ lib/IRGen/GenInit.cpp | 17 ----------------- lib/IRGen/GenType.cpp | 5 ----- lib/IRGen/NonFixedTypeInfo.h | 6 ------ lib/IRGen/TypeInfo.h | 3 --- 6 files changed, 39 deletions(-) diff --git a/lib/IRGen/FixedTypeInfo.h b/lib/IRGen/FixedTypeInfo.h index c3d15da463b..bad9f031b9f 100644 --- a/lib/IRGen/FixedTypeInfo.h +++ b/lib/IRGen/FixedTypeInfo.h @@ -83,8 +83,6 @@ public: StackAddress allocateStack(IRGenFunction &IGF, SILType T, const llvm::Twine &name) const override; - StackAddress allocateVector(IRGenFunction &IGF, SILType T, - llvm::Value *capacity, const Twine &name) const override; void deallocateStack(IRGenFunction &IGF, StackAddress addr, SILType T) const override; void destroyStack(IRGenFunction &IGF, StackAddress addr, SILType T, bool isOutlined) const override; diff --git a/lib/IRGen/GenArray.cpp b/lib/IRGen/GenArray.cpp index 39190515df1..354ee8bfbf6 100644 --- a/lib/IRGen/GenArray.cpp +++ b/lib/IRGen/GenArray.cpp @@ -625,12 +625,6 @@ public: return alloca.withAddress(getAddressForPointer(alloca.getAddressPointer())); } - StackAddress allocateVector(IRGenFunction &IGF, SILType T, - llvm::Value *capacity, - const Twine &name) const override { - llvm_unreachable("not implemented, yet"); - } - void deallocateStack(IRGenFunction &IGF, StackAddress stackAddress, SILType T) const override { IGF.Builder.CreateLifetimeEnd(stackAddress.getAddress().getAddress()); diff --git a/lib/IRGen/GenInit.cpp b/lib/IRGen/GenInit.cpp index 3b457fa6f66..0e6756a3ea7 100644 --- a/lib/IRGen/GenInit.cpp +++ b/lib/IRGen/GenInit.cpp @@ -74,23 +74,6 @@ StackAddress FixedTypeInfo::allocateStack(IRGenFunction &IGF, SILType T, return { alloca }; } -StackAddress FixedTypeInfo::allocateVector(IRGenFunction &IGF, SILType T, - llvm::Value *capacity, - const Twine &name) const { - // If the type is known to be empty, don't actually allocate anything. - if (isKnownEmpty(ResilienceExpansion::Maximal)) { - auto addr = getUndefAddress(); - return { addr }; - } - - StackAddress alloca = - IGF.emitDynamicAlloca(getStorageType(), capacity, getFixedAlignment(), - /*allowTaskAlloc*/ true, name); - IGF.Builder.CreateLifetimeStart(alloca.getAddress(), getFixedSize()); - - return { alloca }; -} - void FixedTypeInfo::destroyStack(IRGenFunction &IGF, StackAddress addr, SILType T, bool isOutlined) const { destroy(IGF, addr.getAddress(), T, isOutlined); diff --git a/lib/IRGen/GenType.cpp b/lib/IRGen/GenType.cpp index 4fcd7813681..082f4cbb761 100644 --- a/lib/IRGen/GenType.cpp +++ b/lib/IRGen/GenType.cpp @@ -1378,11 +1378,6 @@ namespace { const llvm::Twine &name) const override { llvm_unreachable("should not call on an immovable opaque type"); } - StackAddress allocateVector(IRGenFunction &IGF, SILType T, - llvm::Value *capacity, - const Twine &name) const override { - llvm_unreachable("should not call on an immovable opaque type"); - } void deallocateStack(IRGenFunction &IGF, StackAddress addr, SILType T) const override { llvm_unreachable("should not call on an immovable opaque type"); diff --git a/lib/IRGen/NonFixedTypeInfo.h b/lib/IRGen/NonFixedTypeInfo.h index dfeafc0f38b..3bc8f0ed8cb 100644 --- a/lib/IRGen/NonFixedTypeInfo.h +++ b/lib/IRGen/NonFixedTypeInfo.h @@ -72,12 +72,6 @@ public: getAsBitCastAddress(IGF, alloca.getAddressPointer())); } - StackAddress allocateVector(IRGenFunction &IGF, SILType T, - llvm::Value *capacity, - const Twine &name) const override { - llvm_unreachable("not implemented, yet"); - } - void deallocateStack(IRGenFunction &IGF, StackAddress stackAddress, SILType T) const override { IGF.Builder.CreateLifetimeEnd(stackAddress.getAddress().getAddress()); diff --git a/lib/IRGen/TypeInfo.h b/lib/IRGen/TypeInfo.h index 93b26a1bf38..91a7c7bdd3d 100644 --- a/lib/IRGen/TypeInfo.h +++ b/lib/IRGen/TypeInfo.h @@ -357,9 +357,6 @@ public: virtual StackAddress allocateStack(IRGenFunction &IGF, SILType T, const llvm::Twine &name) const = 0; - virtual StackAddress allocateVector(IRGenFunction &IGF, SILType T, - llvm::Value *capacity, - const Twine &name) const = 0; /// Deallocate a variable of this type. virtual void deallocateStack(IRGenFunction &IGF, StackAddress addr, SILType T) const = 0;