From 9abf894ad0e5a6a1594ee1fa3924965e25e5f86f Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Fri, 14 Oct 2016 09:49:42 -0700 Subject: Enable last value generation of periodic sequence. Rationale: This helps to eliminate more dead induction. For example, CaffeineLogic when compiled with latest Jack improves with a 1.3 speedup (2900us -> 2200us) due to eliminating first loop (second loop can be removed also, but for a later case). The currently benchmarks.dex has a different construct for the periodics, however, still to be recognized. Test: test-art-host Change-Id: Ia81649a207a2b1f03ead0855436862ed4e4f45e0 --- compiler/optimizing/induction_var_range.h | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'compiler/optimizing/induction_var_range.h') diff --git a/compiler/optimizing/induction_var_range.h b/compiler/optimizing/induction_var_range.h index 895130064a..2f70046a27 100644 --- a/compiler/optimizing/induction_var_range.h +++ b/compiler/optimizing/induction_var_range.h @@ -139,6 +139,11 @@ class InductionVarRange { induction_analysis_->VisitLoop(loop); } + /** + * Checks if header logic of a loop terminates. + */ + bool IsFinite(HLoopInformation* loop) const; + private: /* * Enum used in IsConstant() request. @@ -218,17 +223,24 @@ class InductionVarRange { * success. With values nullptr, the method can be used to determine if code generation * would be successful without generating actual code yet. */ - bool GenerateCode(HInstruction* context, - HInstruction* instruction, - bool is_last_val, - HGraph* graph, - HBasicBlock* block, - /*out*/ HInstruction** lower, - /*out*/ HInstruction** upper, - /*out*/ HInstruction** taken_test, - /*out*/ int64_t* stride_value, - /*out*/ bool* needs_finite_test, - /*out*/ bool* needs_taken_test) const; + bool GenerateRangeOrLastValue(HInstruction* context, + HInstruction* instruction, + bool is_last_val, + HGraph* graph, + HBasicBlock* block, + /*out*/ HInstruction** lower, + /*out*/ HInstruction** upper, + /*out*/ HInstruction** taken_test, + /*out*/ int64_t* stride_value, + /*out*/ bool* needs_finite_test, + /*out*/ bool* needs_taken_test) const; + + bool GenerateLastValuePeriodic(HInductionVarAnalysis::InductionInfo* info, + HInductionVarAnalysis::InductionInfo* trip, + HGraph* graph, + HBasicBlock* block, + /*out*/HInstruction** result, + /*out*/ bool* needs_taken_test) const; bool GenerateCode(HInductionVarAnalysis::InductionInfo* info, HInductionVarAnalysis::InductionInfo* trip, -- cgit v1.2.3-59-g8ed1b