Skip to content

Commit dff379e

Browse files
authored
Merge pull request #17130 from gottesmm/pr-f12385450cb6239cf447d83b62d75aee350f7d1c
2 parents f65000a + e02266d commit dff379e

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

include/swift/SIL/Projection.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ class ProjectionTree {
841841
///
842842
/// FIXME: This should be a reference to an outside allocator. We shouldn't
843843
/// have each ProjectionTree have its own allocator.
844-
llvm::SpecificBumpPtrAllocator<ProjectionTreeNode> Allocator;
844+
llvm::SpecificBumpPtrAllocator<ProjectionTreeNode> &Allocator;
845845

846846
// A common pattern is a 3 field struct.
847847
llvm::SmallVector<ProjectionTreeNode *, 4> ProjectionTreeNodes;
@@ -851,10 +851,13 @@ class ProjectionTree {
851851

852852
public:
853853
/// Construct a projection tree from BaseTy.
854-
ProjectionTree(SILModule &Mod, SILType BaseTy);
854+
ProjectionTree(SILModule &Mod, SILType BaseTy,
855+
llvm::SpecificBumpPtrAllocator<ProjectionTreeNode> &Allocator);
855856
/// Construct an uninitialized projection tree, which can then be
856857
/// initialized by initializeWithExistingTree.
857-
ProjectionTree(SILModule &Mod) : Mod(Mod) {}
858+
ProjectionTree(SILModule &Mod,
859+
llvm::SpecificBumpPtrAllocator<ProjectionTreeNode> &Allocator)
860+
: Mod(Mod), Allocator(Allocator) {}
858861
~ProjectionTree();
859862
ProjectionTree(const ProjectionTree &) = delete;
860863
ProjectionTree(ProjectionTree &&) = default;

lib/SIL/Projection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,8 +1103,10 @@ class NewAggregateBuilderMap {
11031103
// ProjectionTree
11041104
//===----------------------------------------------------------------------===//
11051105

1106-
ProjectionTree::
1107-
ProjectionTree(SILModule &Mod, SILType BaseTy) : Mod(Mod) {
1106+
ProjectionTree::ProjectionTree(
1107+
SILModule &Mod, SILType BaseTy,
1108+
llvm::SpecificBumpPtrAllocator<ProjectionTreeNode> &Allocator)
1109+
: Mod(Mod), Allocator(Allocator) {
11081110
DEBUG(llvm::dbgs() << "Constructing Projection Tree For : " << BaseTy
11091111
<< "\n");
11101112

lib/SILOptimizer/FunctionSignatureTransforms/FunctionSignatureOpts.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,12 @@ class FunctionSignatureOpts : public SILFunctionTransform {
779779
}
780780

781781
// Allocate the argument and result descriptors.
782+
llvm::SpecificBumpPtrAllocator<ProjectionTreeNode> Allocator;
782783
llvm::SmallVector<ArgumentDescriptor, 4> ArgumentDescList;
783784
llvm::SmallVector<ResultDescriptor, 4> ResultDescList;
784785
auto Args = F->begin()->getFunctionArguments();
785786
for (unsigned i : indices(Args)) {
786-
ArgumentDescList.emplace_back(Args[i]);
787+
ArgumentDescList.emplace_back(Args[i], Allocator);
787788
}
788789
for (SILResultInfo IR : F->getLoweredFunctionType()->getResults()) {
789790
ResultDescList.emplace_back(IR);

lib/SILOptimizer/FunctionSignatureTransforms/FunctionSignatureOpts.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ struct ArgumentDescriptor {
8686
/// to the original argument. The reason why we do this is to make sure we
8787
/// have access to the original argument's state if we modify the argument
8888
/// when optimizing.
89-
ArgumentDescriptor(SILFunctionArgument *A)
89+
ArgumentDescriptor(
90+
SILFunctionArgument *A,
91+
llvm::SpecificBumpPtrAllocator<ProjectionTreeNode> &Allocator)
9092
: Arg(A), PInfo(A->getKnownParameterInfo()), Index(A->getIndex()),
9193
Decl(A->getDecl()), IsEntirelyDead(false), WasErased(false),
9294
Explode(false), OwnedToGuaranteed(false),
9395
IsIndirectResult(A->isIndirectResult()), CalleeRelease(),
94-
CalleeReleaseInThrowBlock(), ProjTree(A->getModule(), A->getType()) {
96+
CalleeReleaseInThrowBlock(),
97+
ProjTree(A->getModule(), A->getType(), Allocator) {
9598
if (!A->isIndirectResult()) {
9699
PInfo = Arg->getKnownParameterInfo();
97100
}

0 commit comments

Comments
 (0)