Allow inlining invokes that contain try catches into catch blocks

Since catch blocks are never considered try blocks, we can
guarantee that its invokes are not inside a TryBoundary (which
is the blocker for enabling inlining of try catch invokes inside
try blocks).

Bug: 227283224
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I747e2e8c2515e36041ad3966ca6a6388ef7d91df
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index e8b9b58..3e3b2d4 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -1440,17 +1440,17 @@
           << " is not inlined because inlining try catches is disabled globally";
       return false;
     }
-    const bool inlined_into_try_catch =
-        // Direct parent is a try catch.
-        invoke_instruction->GetBlock()->GetTryCatchInformation() != nullptr ||
-        // Indirect parent is a try catch.
+    const bool disallowed_try_catch_inlining =
+        // Direct parent is a try block.
+        invoke_instruction->GetBlock()->IsTryBlock() ||
+        // Indirect parent disallows try catch inlining.
         !try_catch_inlining_allowed_;
-    if (inlined_into_try_catch) {
+    if (disallowed_try_catch_inlining) {
       LOG_FAIL(stats_, MethodCompilationStat::kNotInlinedTryCatchCallee)
           << "Method " << method->PrettyMethod()
           << " is not inlined because it has a try catch and we are not supporting it for this"
           << " particular call. This is could be because e.g. it would be inlined inside another"
-          << " try catch, we arrived here from TryInlinePolymorphicCall, etc.";
+          << " try block, we arrived here from TryInlinePolymorphicCall, etc.";
       return false;
     }
   }
@@ -2139,8 +2139,8 @@
   const bool try_catch_inlining_allowed_for_recursive_inline =
       // It was allowed previously.
       try_catch_inlining_allowed_ &&
-      // The current invoke is not in a try or a catch.
-      invoke_instruction->GetBlock()->GetTryCatchInformation() == nullptr;
+      // The current invoke is not a try block.
+      !invoke_instruction->GetBlock()->IsTryBlock();
   RunOptimizations(callee_graph,
                    code_item,
                    dex_compilation_unit,
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 4a0ec93..270bb4f 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -2740,8 +2740,8 @@
     }
   }
 
-  DCHECK_IMPLIES(has_more_specific_try_catch_info, reference->GetTryCatchInformation() == nullptr)
-      << "We don't allow to inline try catches inside of other try catches.";
+  DCHECK_IMPLIES(has_more_specific_try_catch_info, !reference->IsTryBlock())
+      << "We don't allow to inline try catches inside of other try blocks.";
 
   // Update the TryCatchInformation, if we are not inlining a try catch.
   if (!has_more_specific_try_catch_info) {
@@ -2832,6 +2832,7 @@
 
     HBasicBlock* first = entry_block_->GetSuccessors()[0];
     DCHECK(!first->IsInLoop());
+    DCHECK(first->GetTryCatchInformation() == nullptr);
     at->MergeWithInlined(first);
     exit_block_->ReplaceWith(to);