From b29f684b74216e8d652c48ab9f86cc7d1b327e54 Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Fri, 28 Jul 2017 15:58:41 -0700 Subject: Set basic framework for detecting reductions. Rationale: Recognize reductions in loops. Note that reductions are *not* optimized yet (we would proceed with e.g. unrolling and vectorization). This CL merely sets up the basic detection framework. Also does a bit of cleanup on loop optimization code. Bug: 64091002 Test: test-art-host Change-Id: I0f52bd7ca69936315b03d02e83da743b8ad0ae72 --- compiler/optimizing/induction_var_range.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (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 ab1772bf15..0b980f596a 100644 --- a/compiler/optimizing/induction_var_range.h +++ b/compiler/optimizing/induction_var_range.h @@ -150,6 +150,16 @@ class InductionVarRange { return induction_analysis_->LookupCycle(phi); } + /** + * Checks if the given phi instruction has been classified as anything by + * induction variable analysis. Returns false for anything that cannot be + * classified statically, such as reductions or other complex cycles. + */ + bool IsClassified(HPhi* phi) const { + HLoopInformation* lp = phi->GetBlock()->GetLoopInformation(); // closest enveloping loop + return (lp != nullptr) && (induction_analysis_->LookupInfo(lp, phi) != nullptr); + } + /** * Checks if header logic of a loop terminates. Sets trip-count tc if known. */ -- cgit v1.2.3-59-g8ed1b