diff options
author | 2022-04-08 18:00:48 +0100 | |
---|---|---|
committer | 2022-04-14 14:51:30 +0100 | |
commit | 0eca098c263e3f93d9996dbd6070a53d09d4a6c6 (patch) | |
tree | e53180163e8cfcbfc0b8e6b80f45dc60c6bc4c8c /compiler/optimizing/loop_optimization.h | |
parent | d77cf74d29bf53d807b707e5f4da4f7176c08239 (diff) |
Enable LoopOptimization for graphs with try catch blocks
We can enable the optimization when the graph has try catch blocks,
but we do not perform the optimizations if the loops themselves
have try catch blocks.
Bug: 227283906
Change-Id: I8889d2ed7a5a260d5c2dcbbc5184cb7eaf3a8f9f
Diffstat (limited to 'compiler/optimizing/loop_optimization.h')
-rw-r--r-- | compiler/optimizing/loop_optimization.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/optimizing/loop_optimization.h b/compiler/optimizing/loop_optimization.h index 3acd5b191b..b17861648f 100644 --- a/compiler/optimizing/loop_optimization.h +++ b/compiler/optimizing/loop_optimization.h @@ -57,12 +57,23 @@ class HLoopOptimization : public HOptimization { outer(nullptr), inner(nullptr), previous(nullptr), - next(nullptr) {} + next(nullptr), + try_catch_kind(TryCatchKind::kUnknown) {} + + enum class TryCatchKind { + kUnknown, + // Either if we have a try catch in the loop, or if the loop is inside of an outer try catch, + // we set `kHasTryCatch`. + kHasTryCatch, + kNoTryCatch + }; + HLoopInformation* loop_info; LoopNode* outer; LoopNode* inner; LoopNode* previous; LoopNode* next; + TryCatchKind try_catch_kind; }; /* @@ -131,6 +142,11 @@ class HLoopOptimization : public HOptimization { // Returns true if loops nested inside current loop (node) have changed. bool TraverseLoopsInnerToOuter(LoopNode* node); + // Calculates `node`'s `try_catch_kind` and sets it to: + // 1) kHasTryCatch if it has try catches (or if it's inside of an outer try catch) + // 2) kNoTryCatch otherwise. + void CalculateAndSetTryCatchKind(LoopNode* node); + // // Optimization. // |