summaryrefslogtreecommitdiff
path: root/compiler/optimizing/induction_var_analysis.h
diff options
context:
space:
mode:
author Aart Bik <ajcbik@google.com> 2017-11-13 10:31:17 -0800
committer Aart Bik <ajcbik@google.com> 2017-11-20 12:46:37 -0800
commitceb06932313e5146c39fc80d6c3911daa10c534c (patch)
tree1593fb926606899b7a22399d12e24da5ec6fa018 /compiler/optimizing/induction_var_analysis.h
parentcb90e3a29041ea55c4b5eb3d1477aa360381a1f1 (diff)
Recognize countable "break" loops
Rationale: A particular break loop is generated by e.g. Kotlin (or it can be expressed in Java as well) if the upper (or lower) bound is inclusive, but a comparison test would be too dangerous. The ART compiler often has better range analysis (e.g. after inlining) to convert such constructs back to countable loops, which are more amenable to optimizations. For instance, we get more than 200% improvement on the KotlinMicroLoops benchmark, while close to 70 loops are recognized in the Kotlin support library itself. Bug: 67601686 Test: test-art-host test-art-target Change-Id: I67e5c832df57e096efe2cf43a8579d9c10ca33e6
Diffstat (limited to 'compiler/optimizing/induction_var_analysis.h')
-rw-r--r--compiler/optimizing/induction_var_analysis.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/optimizing/induction_var_analysis.h b/compiler/optimizing/induction_var_analysis.h
index 8737b890d9..acad77d35f 100644
--- a/compiler/optimizing/induction_var_analysis.h
+++ b/compiler/optimizing/induction_var_analysis.h
@@ -195,9 +195,14 @@ class HInductionVarAnalysis : public HOptimization {
HInstruction* entry_phi,
HTypeConversion* conversion);
+ //
+ // Loop trip count analysis methods.
+ //
+
// Trip count information.
void VisitControl(HLoopInformation* loop);
void VisitCondition(HLoopInformation* loop,
+ HBasicBlock* body,
InductionInfo* a,
InductionInfo* b,
DataType::Type type,
@@ -219,6 +224,14 @@ class HInductionVarAnalysis : public HOptimization {
int64_t stride_value,
DataType::Type type,
IfCondition cmp);
+ bool RewriteBreakLoop(HLoopInformation* loop,
+ HBasicBlock* body,
+ int64_t stride_value,
+ DataType::Type type);
+
+ //
+ // Helper methods.
+ //
// Assign and lookup.
void AssignInfo(HLoopInformation* loop, HInstruction* instruction, InductionInfo* info);