@@ -538,6 +538,8 @@ class SignatureAnalyzer {
538
538
Allocator (Allocator) {}
539
539
540
540
bool analyze ();
541
+ bool analyzeParameters ();
542
+ bool analyzeResult ();
541
543
542
544
// / Returns the mangled name of the function that should be generated from
543
545
// / this function analyzer.
@@ -598,10 +600,7 @@ class SignatureOptimizer {
598
600
599
601
} // end anonymous namespace
600
602
601
- // / This function goes through the arguments of F and sees if we have anything
602
- // / to optimize in which case it returns true. If we have nothing to optimize,
603
- // / it returns false.
604
- bool SignatureAnalyzer::analyze () {
603
+ bool SignatureAnalyzer::analyzeParameters () {
605
604
// For now ignore functions with indirect results.
606
605
if (F->getLoweredFunctionType ()->hasIndirectResults ())
607
606
return false ;
@@ -682,6 +681,17 @@ bool SignatureAnalyzer::analyze() {
682
681
// Add the argument to our list.
683
682
ArgDescList.push_back (std::move (A));
684
683
}
684
+
685
+ return ShouldOptimize;
686
+ }
687
+
688
+ bool SignatureAnalyzer::analyzeResult () {
689
+ // For now ignore functions with indirect results.
690
+ if (F->getLoweredFunctionType ()->hasIndirectResults ())
691
+ return false ;
692
+
693
+ // Did we decide we should optimize any parameter?
694
+ bool ShouldOptimize = false ;
685
695
686
696
// Analyze return result information.
687
697
auto DirectResults = F->getLoweredFunctionType ()->getDirectResults ();
@@ -703,10 +713,18 @@ bool SignatureAnalyzer::analyze() {
703
713
++NumOwnedConvertedToNotOwnedResult;
704
714
}
705
715
}
706
-
707
716
return ShouldOptimize;
708
717
}
709
718
719
+ // / This function goes through the arguments of F and sees if we have anything
720
+ // / to optimize in which case it returns true. If we have nothing to optimize,
721
+ // / it returns false.
722
+ bool SignatureAnalyzer::analyze () {
723
+ bool OptimizedParams = analyzeParameters ();
724
+ bool OptimizedResult = analyzeResult ();
725
+ return OptimizedParams || OptimizedResult;
726
+ }
727
+
710
728
// ===----------------------------------------------------------------------===//
711
729
// Mangling
712
730
// ===----------------------------------------------------------------------===//
0 commit comments