summaryrefslogtreecommitdiff
path: root/compiler/optimizing/induction_var_analysis.h
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2023-01-12 16:10:05 +0000
committer Santiago Aboy Solanes <solanes@google.com> 2023-01-30 10:21:34 +0000
commit3633fe4e7dc8a4acaea0d9911c86683b51c1db2b (patch)
treeca7fd3a8ae28231aa6d120f14900c44b528ecefb /compiler/optimizing/induction_var_analysis.h
parentb6c230117d189c79eaf7e063f2f3fa5fec399aca (diff)
Skip InductionVarAnalysis for a pathological case
Having a long chain of loop header phis hangs up the compiler. Note that we can still compile the method if we skip the InductionVarAnalysis phase. Bug: 246249941 Fixes: 246249941 Bug: 32545907 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: dex2oat compile the app in 246249941 Change-Id: Id2d14b1c4d787f98d656055274c7cfcae6491686
Diffstat (limited to 'compiler/optimizing/induction_var_analysis.h')
-rw-r--r--compiler/optimizing/induction_var_analysis.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/optimizing/induction_var_analysis.h b/compiler/optimizing/induction_var_analysis.h
index 124c3b4e64..050950089a 100644
--- a/compiler/optimizing/induction_var_analysis.h
+++ b/compiler/optimizing/induction_var_analysis.h
@@ -39,7 +39,9 @@ namespace art HIDDEN {
*/
class HInductionVarAnalysis : public HOptimization {
public:
- explicit HInductionVarAnalysis(HGraph* graph, const char* name = kInductionPassName);
+ explicit HInductionVarAnalysis(HGraph* graph,
+ OptimizingCompilerStats* stats = nullptr,
+ const char* name = kInductionPassName);
bool Run() override;
@@ -308,6 +310,15 @@ class HInductionVarAnalysis : public HOptimization {
static std::string FetchToString(HInstruction* fetch);
static std::string InductionToString(InductionInfo* info);
+ // Returns true if we have a pathological case we don't want to analyze.
+ bool IsPathologicalCase();
+ // Starting with initial_phi, it calculates how many loop header phis in a row we have. To do
+ // this, we count the loop header phi which are used as an input of other loop header phis. It
+ // uses `cached_values` to avoid recomputing results.
+ void CalculateLoopHeaderPhisInARow(HPhi* initial_phi,
+ ScopedArenaSafeMap<HPhi*, int>& cached_values,
+ ScopedArenaAllocator& allocator);
+
/**
* Maintains the results of the analysis as a mapping from loops to a mapping from instructions
* to the induction information for that instruction in that loop.