From 81869cc06c19d5e549d369ff86d581efb87cf2b8 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Thu, 6 Apr 2023 16:13:44 +0100 Subject: Coalesce Return/ReturnVoid instructions We do this to avoid generating the exit frame code several times. We don't create new Return/ReturnVoid instructions after the inliner, and CodeSinking looks like a logical place to add this optimization. Locally, speed-compiling in Pixel 5: * system server: -516.05KB (1.1%) * SystemUIGoogle: -216.50KB (0.8%) * AGSA: -3021.91KB (0.93%) Bug: 203237752 Bug: 188926997 Bug: 194133637 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Ib149382462efac82a0bbc114cbdbc773e1a5228c --- compiler/optimizing/code_sinking.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/code_sinking.h') diff --git a/compiler/optimizing/code_sinking.h b/compiler/optimizing/code_sinking.h index 14f62f2417..c743db40d9 100644 --- a/compiler/optimizing/code_sinking.h +++ b/compiler/optimizing/code_sinking.h @@ -39,10 +39,16 @@ class CodeSinking : public HOptimization { static constexpr const char* kCodeSinkingPassName = "code_sinking"; private: - // Try to move code only used by `end_block` and all its post-dominated / dominated + // Tries to sink code to uncommon branches. + void UncommonBranchSinking(); + // Tries to move code only used by `end_block` and all its post-dominated / dominated // blocks, to these blocks. void SinkCodeToUncommonBranch(HBasicBlock* end_block); + // Coalesces the Return/ReturnVoid instructions into one, if we have two or more. We do this to + // avoid generating the exit frame code several times. + void ReturnSinking(); + DISALLOW_COPY_AND_ASSIGN(CodeSinking); }; -- cgit v1.2.3-59-g8ed1b