Skip to content

Commit c4a3b66

Browse files
authored
Merge pull request swiftlang#16768 from gottesmm/pr-e19dbc70c1286f6b1a484d16427852393343589f
2 parents 832edd1 + e8af11d commit c4a3b66

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

include/swift/SIL/Projection.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -926,17 +926,16 @@ class ProjectionTree {
926926
return false;
927927
}
928928

929-
930-
void getLeafTypes(llvm::SmallVectorImpl<SILType> &OutArray) const {
929+
void getLiveLeafTypes(llvm::SmallVectorImpl<SILType> &OutArray) const {
931930
for (unsigned LeafIndex : LiveLeafIndices) {
932931
const ProjectionTreeNode *Node = getNode(LeafIndex);
933932
assert(Node->IsLive && "We are only interested in leafs that are live");
934933
OutArray.push_back(Node->getType());
935934
}
936935
}
937936

938-
void
939-
getLeafNodes(llvm::SmallVectorImpl<const ProjectionTreeNode *> &Out) const {
937+
void getLiveLeafNodes(
938+
llvm::SmallVectorImpl<const ProjectionTreeNode *> &Out) const {
940939
for (unsigned LeafIndex : LiveLeafIndices) {
941940
const ProjectionTreeNode *Node = getNode(LeafIndex);
942941
assert(Node->IsLive && "We are only interested in leafs that are live");
@@ -945,9 +944,7 @@ class ProjectionTree {
945944
}
946945

947946
/// Return the number of live leafs in the projection.
948-
size_t liveLeafCount() const {
949-
return LiveLeafIndices.size();
950-
}
947+
unsigned getLiveLeafCount() const { return LiveLeafIndices.size(); }
951948

952949
void createTreeFromValue(SILBuilder &B, SILLocation Loc, SILValue NewBase,
953950
llvm::SmallVectorImpl<SILValue> &Leafs) const;

lib/SIL/Projection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ computeUsesAndLiveness(SILValue Base) {
12441244
#ifndef NDEBUG
12451245
DEBUG(llvm::dbgs() << "Final Leafs: \n");
12461246
llvm::SmallVector<SILType, 8> LeafTypes;
1247-
getLeafTypes(LeafTypes);
1247+
getLiveLeafTypes(LeafTypes);
12481248
for (SILType Leafs : LeafTypes) {
12491249
DEBUG(llvm::dbgs() << " " << Leafs << "\n");
12501250
}

lib/SILOptimizer/Transforms/FunctionSignatureOpts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void FunctionSignatureTransformDescriptor::computeOptimizedArgInterface(
465465
if (AD.Explode) {
466466
++NumSROAArguments;
467467
llvm::SmallVector<const ProjectionTreeNode *, 8> LeafNodes;
468-
AD.ProjTree.getLeafNodes(LeafNodes);
468+
AD.ProjTree.getLiveLeafNodes(LeafNodes);
469469
for (auto Node : LeafNodes) {
470470
SILType Ty = Node->getType();
471471
DEBUG(llvm::dbgs() << " " << Ty << "\n");
@@ -1130,7 +1130,7 @@ void FunctionSignatureTransform::ArgumentExplosionFinalizeOptimizedFunction() {
11301130
// We do this in the same order as leaf types since ProjTree expects that the
11311131
// order of leaf values matches the order of leaf types.
11321132
llvm::SmallVector<const ProjectionTreeNode*, 8> LeafNodes;
1133-
AD.ProjTree.getLeafNodes(LeafNodes);
1133+
AD.ProjTree.getLiveLeafNodes(LeafNodes);
11341134

11351135
for (auto *Node : LeafNodes) {
11361136
auto OwnershipKind = *AD.getTransformedOwnershipKind(Node->getType());

lib/SILOptimizer/Transforms/FunctionSignatureOpts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct ArgumentDescriptor {
149149
ERM.hasSomeReleasesForArgument(Arg))
150150
return true;
151151

152-
size_t explosionSize = ProjTree.liveLeafCount();
152+
unsigned explosionSize = ProjTree.getLiveLeafCount();
153153
return explosionSize >= 1 && explosionSize <= 3;
154154
}
155155

0 commit comments

Comments
 (0)