Skip to content

Commit 4429861

Browse files
committed
Ignore leaf node thing if we have only direct caller.
1 parent 1a0d762 commit 4429861

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/SILOptimizer/FunctionSignatureTransforms/ArgumentExplosionTransform.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,18 @@ shouldExplode(FunctionSignatureTransformDescriptor &transformDesc,
151151
return n->getType().isTrivial(module);
152152
});
153153

154-
// If we reduced the number of non-trivial leaf types, we want to split this
155-
// given that we already know that we are not going to drastically change the
156-
// number of arguments.
157-
if (naiveExplosionSize <= maxExplosionSize &&
158-
numNonTrivialLiveLeafNodes < numInputNonTrivialLeafNodes) {
159-
return true;
154+
// If we will reduce the number of values without adding too many arguments...
155+
if (naiveExplosionSize <= maxExplosionSize) {
156+
// ... and we know that we will not introduce a thunk, be aggressive.
157+
if (transformDesc.hasOnlyDirectCallers) {
158+
return true;
159+
}
160+
161+
// Otherwise, only explode if we will reduce the number of non-trivial leaf
162+
// types.
163+
if (numNonTrivialLiveLeafNodes < numInputNonTrivialLeafNodes) {
164+
return true;
165+
}
160166
}
161167

162168
// Ok, this is an argument with more than 3 live leaf nodes. See if after

0 commit comments

Comments
 (0)