From 3633fe4e7dc8a4acaea0d9911c86683b51c1db2b Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Thu, 12 Jan 2023 16:10:05 +0000 Subject: 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 --- compiler/optimizing/induction_var_analysis.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/induction_var_analysis.h') 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& 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. -- cgit v1.2.3-59-g8ed1b