@@ -641,18 +641,6 @@ bool FunctionSignatureTransform::run(bool hasCaller) {
641
641
TransformDescriptor.hasOnlyDirectInModuleCallers ;
642
642
SILFunction *F = TransformDescriptor.OriginalFunction ;
643
643
644
- // Never repeat the same function signature optimization on the same function.
645
- // Multiple function signature optimizations are composed by successively
646
- // optmizing the newly created functions. Each optimization creates a new
647
- // level of thunk. Those should all be ultimately inlined away.
648
- //
649
- // This happens, for example, when a new reference to the original function is
650
- // discovered during devirtualization. That will cause the original function
651
- // (now and FSO thunk) to be pushed back on the function pass pipeline.
652
- if (F->isThunk () == IsSignatureOptimizedThunk) {
653
- LLVM_DEBUG (llvm::dbgs () << " FSO already performed on this thunk\n " );
654
- return false ;
655
- }
656
644
657
645
// If we are asked to assume a caller for testing purposes, set the flag.
658
646
hasCaller |= FSOOptimizeIfNotCalled;
@@ -814,6 +802,19 @@ class FunctionSignatureOpts : public SILFunctionTransform {
814
802
return ;
815
803
}
816
804
805
+ // Never repeat the same function signature optimization on the same
806
+ // function. Multiple function signature optimizations are composed by
807
+ // successively optmizing the newly created functions. Each optimization
808
+ // creates a new level of thunk which are all ultimately inlined away.
809
+ //
810
+ // This happens, for example, when a reference to the original function is
811
+ // discovered during devirtualization. That will cause the original function
812
+ // (now an FSO thunk) to be pushed back on the function pass pipeline.
813
+ if (F->isThunk () == IsSignatureOptimizedThunk) {
814
+ LLVM_DEBUG (llvm::dbgs () << " FSO already performed on this thunk\n " );
815
+ return ;
816
+ }
817
+
817
818
// Ok, we think we can perform optimization. Now perform a quick check
818
819
auto *RCIA = getAnalysis<RCIdentityAnalysis>();
819
820
auto *EA = PM->getAnalysis <EpilogueARCAnalysis>();
0 commit comments