Merge "Allow inlining of methods that throw"
diff --git a/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionIterator.java b/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionIterator.java
index 81e79e6..09bc9cb 100644
--- a/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionIterator.java
+++ b/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionIterator.java
@@ -364,7 +364,7 @@
       castInstruction.setPosition(invoke.getPosition());
 
       // Splice in the check cast operation.
-      if (entryBlock.canThrow() || invokeBlock.hasCatchHandlers()) {
+      if (entryBlock.canThrow()) {
         // Since the cast-instruction may also fail we need to create a new block for the cast.
         //
         // Note that the downcast of the receiver is made at the call site, so we need to copy the
@@ -410,13 +410,7 @@
 
     BasicBlock inlineExit = null;
     ImmutableList<BasicBlock> normalExits = inlinee.computeNormalExitBlocks();
-    if (normalExits.isEmpty()) {
-      assert inlineeCanThrow;
-      // TODO(sgjesse): Remove this restriction (see b/64432527).
-      assert !invokeBlock.hasCatchHandlers();
-      blocksToRemove.addAll(
-          invokePredecessor.unlink(invokeBlock, new DominatorTree(code)));
-    } else {
+    if (!normalExits.isEmpty()) {
       // Ensure and locate the single return instruction of the inlinee.
       InstructionListIterator inlineeIterator = ensureSingleReturnInstruction(inlinee, normalExits);
 
@@ -475,6 +469,25 @@
       appendCatchHandlers(code, invokeBlock, inlinee, blocksIterator);
     }
 
+    // If there are no normal exists, then unlink the invoke block and all the blocks that it
+    // dominates. This must be done after the catch handlers have been appended to the inlinee,
+    // since the catch handlers are dominated by the inline block until then (meaning that the
+    // catch handlers would otherwise be removed although they are not actually dead).
+    if (normalExits.isEmpty()) {
+      assert inlineeCanThrow;
+      blocksToRemove.addAll(invokePredecessor.unlink(invokeBlock, new DominatorTree(code)));
+    }
+
+    // Position the iterator after the invoke block.
+    blocksIterator.next();
+    assert IteratorUtils.peekPrevious(blocksIterator) == invokeBlock;
+
+    // Check that the successor of the invoke block is still to be processed,
+    final BasicBlock finalInvokeSuccessor = invokeSuccessor;
+    assert invokeSuccessor == invokeBlock
+        || IteratorUtils.anyRemainingMatch(
+            blocksIterator, remaining -> remaining == finalInvokeSuccessor);
+
     return invokeSuccessor;
   }
 
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/DefaultInliningOracle.java b/src/main/java/com/android/tools/r8/ir/optimize/DefaultInliningOracle.java
index 998ebe9..823de39 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/DefaultInliningOracle.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/DefaultInliningOracle.java
@@ -20,6 +20,7 @@
 import com.android.tools.r8.ir.optimize.Inliner.Reason;
 import com.android.tools.r8.logging.Log;
 import com.android.tools.r8.utils.InternalOptions;
+import com.android.tools.r8.utils.IteratorUtils;
 import java.util.BitSet;
 import java.util.List;
 import java.util.ListIterator;
@@ -366,21 +367,29 @@
   }
 
   @Override
-  public ListIterator<BasicBlock> updateTypeInformationIfNeeded(IRCode inlinee,
-      ListIterator<BasicBlock> blockIterator, BasicBlock block, BasicBlock invokeSuccessor) {
+  public void updateTypeInformationIfNeeded(
+      IRCode inlinee, ListIterator<BasicBlock> blockIterator, BasicBlock block) {
     if (inliner.options.enableNonNullTracking) {
-      // Move the cursor back to where the inlinee blocks are added.
-      blockIterator = code.blocks.listIterator(code.blocks.indexOf(block));
+      BasicBlock state = IteratorUtils.peekNext(blockIterator);
+      // Move the cursor back to where the first inlinee block was added.
+      while (blockIterator.hasPrevious() && blockIterator.previous() != block) {
+        // Do nothing.
+      }
+      assert IteratorUtils.peekNext(blockIterator) == block;
+
       // Kick off the tracker to add non-null IRs only to the inlinee blocks.
-      new NonNullTracker()
-          .addNonNullInPart(code, blockIterator, inlinee.blocks::contains);
-      // Move the cursor forward to where the inlinee blocks end.
-      blockIterator = code.blocks.listIterator(code.blocks.indexOf(invokeSuccessor));
+      new NonNullTracker().addNonNullInPart(code, blockIterator, inlinee.blocks::contains);
+      assert !blockIterator.hasNext();
+
+      // Restore the old state of the iterator.
+      while (blockIterator.hasPrevious() && blockIterator.previous() != state) {
+        // Do nothing.
+      }
+      assert IteratorUtils.peekNext(blockIterator) == state;
     }
     // Update type env for inlined blocks.
     typeEnvironment.analyzeBlocks(inlinee.topologicallySortedBlocks());
     // TODO(b/69964136): need a test where refined env in inlinee affects the caller.
-    return blockIterator;
   }
 
   @Override
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/ForcedInliningOracle.java b/src/main/java/com/android/tools/r8/ir/optimize/ForcedInliningOracle.java
index 85f7a39..07100fa 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/ForcedInliningOracle.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/ForcedInliningOracle.java
@@ -70,10 +70,8 @@
   }
 
   @Override
-  public ListIterator<BasicBlock> updateTypeInformationIfNeeded(IRCode inlinee,
-      ListIterator<BasicBlock> blockIterator, BasicBlock block, BasicBlock invokeSuccessor) {
-    return blockIterator;
-  }
+  public void updateTypeInformationIfNeeded(
+      IRCode inlinee, ListIterator<BasicBlock> blockIterator, BasicBlock block) {}
 
   @Override
   public boolean exceededAllowance() {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
index 106d537..491269e 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
@@ -591,11 +591,6 @@
                 result.buildInliningIR(code.valueNumberGenerator,
                     appInfo, converter.getGraphLense(), options, invokePosition);
             if (inlinee != null) {
-              // TODO(64432527): Get rid of this additional check by improved inlining.
-              if (block.hasCatchHandlers() && inlinee.computeNormalExitBlocks().isEmpty()) {
-                continue;
-              }
-
               // If this code did not go through the full pipeline, apply inlining to make sure
               // that force inline targets get processed.
               strategy.ensureMethodProcessed(target, inlinee);
@@ -611,10 +606,8 @@
               iterator.previous();
               strategy.markInlined(inlinee);
               if (!strategy.exceededAllowance() || result.ignoreInstructionBudget()) {
-                BasicBlock invokeSuccessor =
-                    iterator.inlineInvoke(code, inlinee, blockIterator, blocksToRemove, downcast);
-                blockIterator = strategy.
-                    updateTypeInformationIfNeeded(inlinee, blockIterator, block, invokeSuccessor);
+                iterator.inlineInvoke(code, inlinee, blockIterator, blocksToRemove, downcast);
+                strategy.updateTypeInformationIfNeeded(inlinee, blockIterator, block);
 
                 // If we inlined the invoke from a bridge method, it is no longer a bridge method.
                 if (method.accessFlags.isBridge()) {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java b/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java
index 129e9cb..de657de 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java
@@ -190,8 +190,7 @@
   }
 
   public ConstraintWithTarget forMoveException() {
-    // TODO(64432527): Revisit this constraint.
-    return ConstraintWithTarget.NEVER;
+    return ConstraintWithTarget.ALWAYS;
   }
 
   public ConstraintWithTarget forNewArrayEmpty(DexType type, DexType invocationContext) {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/InliningStrategy.java b/src/main/java/com/android/tools/r8/ir/optimize/InliningStrategy.java
index 2443d11..90554f6 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/InliningStrategy.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/InliningStrategy.java
@@ -20,8 +20,8 @@
 
   boolean isValidTarget(InvokeMethod invoke, DexEncodedMethod target, IRCode inlinee);
 
-  ListIterator<BasicBlock> updateTypeInformationIfNeeded(IRCode inlinee,
-      ListIterator<BasicBlock> blockIterator, BasicBlock block, BasicBlock invokeSuccessor);
+  void updateTypeInformationIfNeeded(
+      IRCode inlinee, ListIterator<BasicBlock> blockIterator, BasicBlock block);
 
   DexType getReceiverTypeIfKnown(InvokeMethod invoke);
 }
diff --git a/src/main/java/com/android/tools/r8/utils/IteratorUtils.java b/src/main/java/com/android/tools/r8/utils/IteratorUtils.java
index 3cc3245..d0a126a 100644
--- a/src/main/java/com/android/tools/r8/utils/IteratorUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/IteratorUtils.java
@@ -5,6 +5,7 @@
 package com.android.tools.r8.utils;
 
 import java.util.ListIterator;
+import java.util.function.Predicate;
 
 public class IteratorUtils {
   public static <T> T peekPrevious(ListIterator<T> iterator) {
@@ -20,4 +21,25 @@
     assert previous == next;
     return next;
   }
+
+  public static <T> boolean allRemainingMatch(ListIterator<T> iterator, Predicate<T> predicate) {
+    return !anyRemainingMatch(iterator, remaining -> !predicate.test(remaining));
+  }
+
+  public static <T> boolean anyRemainingMatch(ListIterator<T> iterator, Predicate<T> predicate) {
+    T state = peekNext(iterator);
+    boolean result = false;
+    while (iterator.hasNext()) {
+      T item = iterator.next();
+      if (predicate.test(item)) {
+        result = true;
+        break;
+      }
+    }
+    while (iterator.hasPrevious() && iterator.previous() != state) {
+      // Restore the state of the iterator.
+    }
+    assert peekNext(iterator) == state;
+    return result;
+  }
 }
diff --git a/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java b/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
index 180a5f8..d78f94b 100644
--- a/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
+++ b/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
@@ -985,27 +985,28 @@
               TestCondition.match(TestCondition.runtimes(DexVm.Version.V4_0_4)))
           .build();
 
-  public static List<String> requireInliningToBeDisabled = ImmutableList.of(
-      // Test for a specific stack trace that gets destroyed by inlining.
-      "492-checker-inline-invoke-interface",
-      "493-checker-inline-invoke-interface",
-      "488-checker-inline-recursive-calls",
-      "487-checker-inline-calls",
-      "122-npe",
-      "141-class-unload",
+  public static List<String> requireInliningToBeDisabled =
+      ImmutableList.of(
+          // Test for a specific stack trace that gets destroyed by inlining.
+          "008-exceptions",
+          "492-checker-inline-invoke-interface",
+          "493-checker-inline-invoke-interface",
+          "488-checker-inline-recursive-calls",
+          "487-checker-inline-calls",
+          "122-npe",
+          "141-class-unload",
 
-      // Calls some internal art methods that cannot tolerate inlining.
-      "466-get-live-vreg",
+          // Calls some internal art methods that cannot tolerate inlining.
+          "466-get-live-vreg",
 
-      // Requires a certain call pattern to surface an Art bug.
-      "534-checker-bce-deoptimization",
+          // Requires a certain call pattern to surface an Art bug.
+          "534-checker-bce-deoptimization",
 
-      // Requires something to be allocated in a method so that it goes out of scope.
-      "059-finalizer-throw",
+          // Requires something to be allocated in a method so that it goes out of scope.
+          "059-finalizer-throw",
 
-      // Has tests in submethods, which we should not inline.
-      "625-checker-licm-regressions"
-  );
+          // Has tests in submethods, which we should not inline.
+          "625-checker-licm-regressions");
 
   private static List<String> requireClassInliningToBeDisabled = ImmutableList.of(
       // Test is registered to be failing (failingRunWithArt), it fails only on 4.0.4
diff --git a/src/test/java/com/android/tools/r8/ir/optimize/R8InliningTest.java b/src/test/java/com/android/tools/r8/ir/optimize/R8InliningTest.java
index dd7756b..8c5a738 100644
--- a/src/test/java/com/android/tools/r8/ir/optimize/R8InliningTest.java
+++ b/src/test/java/com/android/tools/r8/ir/optimize/R8InliningTest.java
@@ -90,7 +90,7 @@
     return Paths.get(temp.getRoot().getCanonicalPath(), DEFAULT_DEX_FILENAME);
   }
 
-  private String getGeneratedProguardMap() throws IOException {
+  private String getGeneratedProguardMap() {
     Path mapFile = temp.getRoot().toPath().resolve(DEFAULT_MAP_FILENAME);
     if (Files.exists(mapFile)) {
       return mapFile.toAbsolutePath().toString();
@@ -116,9 +116,14 @@
       commandBuilder.addProguardConfiguration(
           ImmutableList.of("-allowaccessmodification"), Origin.unknown());
     }
-    ToolHelper.runR8(commandBuilder.build(), o -> {
-      o.enableMinification = minification;
-    });
+    ToolHelper.runR8(
+        commandBuilder.build(),
+        o -> {
+          // Disable class inlining to prevent that the instantiation of Nullability is removed, and
+          // that the class is therefore made abstract.
+          o.enableClassInlining = false;
+          o.enableMinification = minification;
+        });
     String artOutput =
         ToolHelper.runArtNoVerificationErrors(out + "/classes.dex", "inlining.Inlining");
 
diff --git a/src/test/java/com/android/tools/r8/ir/optimize/inliner/InlinerTest.java b/src/test/java/com/android/tools/r8/ir/optimize/inliner/InlinerTest.java
index 5cdaac8..95343df 100644
--- a/src/test/java/com/android/tools/r8/ir/optimize/inliner/InlinerTest.java
+++ b/src/test/java/com/android/tools/r8/ir/optimize/inliner/InlinerTest.java
@@ -9,10 +9,12 @@
 import static org.junit.Assert.fail;
 
 import com.android.tools.r8.OutputMode;
+import com.android.tools.r8.R8Command;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.ProcessResult;
 import com.android.tools.r8.VmTestRunner;
+import com.android.tools.r8.ir.optimize.inliner.exceptionhandling.ExceptionHandlingTestClass;
 import com.android.tools.r8.ir.optimize.inliner.interfaces.InterfaceTargetsTestClass;
 import com.android.tools.r8.ir.optimize.inliner.interfaces.InterfaceTargetsTestClass.IfaceA;
 import com.android.tools.r8.ir.optimize.inliner.interfaces.InterfaceTargetsTestClass.IfaceB;
@@ -20,12 +22,15 @@
 import com.android.tools.r8.ir.optimize.inliner.interfaces.InterfaceTargetsTestClass.IfaceD;
 import com.android.tools.r8.ir.optimize.inliner.interfaces.InterfaceTargetsTestClass.IfaceNoImpl;
 import com.android.tools.r8.naming.MemberNaming.MethodSignature;
+import com.android.tools.r8.origin.Origin;
 import com.android.tools.r8.utils.AndroidApp;
 import com.android.tools.r8.utils.InternalOptions;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
 import com.android.tools.r8.utils.codeinspector.CodeInspector;
 import com.android.tools.r8.utils.codeinspector.MethodSubject;
+import com.google.common.collect.ImmutableList;
 import java.nio.file.Path;
+import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import org.junit.Test;
@@ -33,6 +38,30 @@
 
 @RunWith(VmTestRunner.class)
 public class InlinerTest extends TestBase {
+
+  @Test
+  public void testExceptionHandling() throws Exception {
+    String className = ExceptionHandlingTestClass.class.getName();
+    AndroidApp inputApp = readClasses(ExceptionHandlingTestClass.class);
+    List<String> proguardConfig =
+        ImmutableList.of(
+            "-keep public class " + className + "{",
+            "  public static void main(...);",
+            "}",
+            "-forceinline public class " + className + "{",
+            "  private static void inlinee*(...);",
+            "}",
+            "-neverinline public class " + className + "{",
+            "  private static void *Test(...);",
+            "}");
+    R8Command.Builder commandBuilder =
+        ToolHelper.prepareR8CommandBuilder(inputApp)
+            .addProguardConfiguration(proguardConfig, Origin.unknown());
+    ToolHelper.allowTestProguardOptions(commandBuilder);
+    AndroidApp outputApp = ToolHelper.runR8(commandBuilder.build(), this::configure);
+    assertEquals(runOnJava(ExceptionHandlingTestClass.class), runOnArt(outputApp, className));
+  }
+
   @Test
   public void testInterfacesWithoutTargets() throws Exception {
     byte[][] classes = {
diff --git a/src/test/java/com/android/tools/r8/ir/optimize/inliner/exceptionhandling/ExceptionHandlingTestClass.java b/src/test/java/com/android/tools/r8/ir/optimize/inliner/exceptionhandling/ExceptionHandlingTestClass.java
new file mode 100644
index 0000000..cda0856
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/ir/optimize/inliner/exceptionhandling/ExceptionHandlingTestClass.java
@@ -0,0 +1,91 @@
+// Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+package com.android.tools.r8.ir.optimize.inliner.exceptionhandling;
+
+public class ExceptionHandlingTestClass {
+
+  private static boolean FALSE;
+
+  // -keep
+  public static void main(String[] args) {
+    FALSE = args == null;
+    try {
+      methodWithoutCatchHandlersTest(1);
+      System.out.println("Test succeeded: methodWithoutCatchHandlersTest(1)");
+    } catch (Exception e) {
+      System.out.println("Test failed: methodWithoutCatchHandlersTest(1)");
+    }
+    try {
+      methodWithoutCatchHandlersTest(2);
+      System.out.println("Test failed: methodWithoutCatchHandlersTest(2)");
+    } catch (Exception e) {
+      System.out.println("Test succeeded: methodWithoutCatchHandlersTest(2)");
+    }
+    try {
+      methodWithoutCatchHandlersTest(3);
+      System.out.println("Test failed: methodWithoutCatchHandlersTest(3)");
+    } catch (Exception e) {
+      System.out.println("Test succeeded: methodWithoutCatchHandlersTest(3)");
+    }
+
+    methodWithCatchHandlersTest();
+  }
+
+  // -neverinline
+  private static void methodWithoutCatchHandlersTest(int i) {
+    switch (i) {
+      case 1:
+        inlineeWithNormalExitThatDoesNotThrow();
+        break;
+
+      case 2:
+        inlineeWithNormalExitThatThrows();
+        break;
+
+      case 3:
+        inlineeWithoutNormalExit();
+        break;
+    }
+  }
+
+  // -neverinline
+  private static void methodWithCatchHandlersTest() {
+    try {
+      inlineeWithNormalExitThatDoesNotThrow();
+      System.out.println("Test succeeded: methodWithCatchHandlersTest(1)");
+    } catch (Exception e) {
+
+    }
+    try {
+      inlineeWithNormalExitThatThrows();
+    } catch (Exception e) {
+      System.out.println("Test succeeded: methodWithCatchHandlersTest(2)");
+    }
+    try {
+      inlineeWithoutNormalExit();
+    } catch (Exception e) {
+      System.out.println("Test succeeded: methodWithCatchHandlersTest(3)");
+    }
+  }
+
+  // -forceinline
+  private static void inlineeWithNormalExitThatDoesNotThrow() {
+    if (FALSE) {
+      throw new RuntimeException();
+    }
+  }
+
+  // -forceinline
+  private static void inlineeWithNormalExitThatThrows() {
+    if (!FALSE) {
+      throw new RuntimeException();
+    }
+  }
+
+  // -forceinline
+  private static void inlineeWithoutNormalExit() {
+    throw new RuntimeException();
+  }
+}
diff --git a/src/test/java/com/android/tools/r8/kotlin/KotlinLambdaMergingTest.java b/src/test/java/com/android/tools/r8/kotlin/KotlinLambdaMergingTest.java
index e43e94c..b8c4b47 100644
--- a/src/test/java/com/android/tools/r8/kotlin/KotlinLambdaMergingTest.java
+++ b/src/test/java/com/android/tools/r8/kotlin/KotlinLambdaMergingTest.java
@@ -270,42 +270,44 @@
   @Test
   public void testTrivialKs() throws Exception {
     final String mainClassName = "lambdas_kstyle_trivial.MainKt";
-    runTest("lambdas_kstyle_trivial", mainClassName, optionsModifier, (app) -> {
-      Verifier verifier = new Verifier(app);
-      String pkg = "lambdas_kstyle_trivial";
+    runTest(
+        "lambdas_kstyle_trivial",
+        mainClassName,
+        optionsModifier,
+        (app) -> {
+          Verifier verifier = new Verifier(app);
+          String pkg = "lambdas_kstyle_trivial";
 
-      verifier.assertLambdaGroups(
-          allowAccessModification ?
-              new Group[]{
-                  kstyle("", 0, 4),
-                  kstyle("", 1, 8),
-                  kstyle("", 2, 2), // -\
-                  kstyle("", 2, 5), // - 3 groups different by main method
-                  kstyle("", 2, 4), // -/
-                  kstyle("", 3, 2),
-                  kstyle("", 22, 2)} :
-              new Group[]{
-                  kstyle(pkg, 0, 2),
-                  kstyle(pkg, 1, 4),
-                  kstyle(pkg, 2, 5), // - 2 groups different by main method
-                  kstyle(pkg, 2, 4), // -/
-                  kstyle(pkg, 3, 2),
-                  kstyle(pkg, 22, 2),
-                  kstyle(pkg + "/inner", 0, 2),
-                  kstyle(pkg + "/inner", 1, 4)}
-      );
+          verifier.assertLambdaGroups(
+              allowAccessModification
+                  ? new Group[] {
+                    kstyle("", 0, 4),
+                    kstyle("", 1, 9),
+                    kstyle("", 2, 2), // -\
+                    kstyle("", 2, 5), // - 3 groups different by main method
+                    kstyle("", 2, 4), // -/
+                    kstyle("", 3, 2),
+                    kstyle("", 22, 2)
+                  }
+                  : new Group[] {
+                    kstyle(pkg, 0, 2),
+                    kstyle(pkg, 1, 5),
+                    kstyle(pkg, 2, 5), // - 2 groups different by main method
+                    kstyle(pkg, 2, 4), // -/
+                    kstyle(pkg, 3, 2),
+                    kstyle(pkg, 22, 2),
+                    kstyle(pkg + "/inner", 0, 2),
+                    kstyle(pkg + "/inner", 1, 4)
+                  });
 
-      verifier.assertLambdas(
-          allowAccessModification ?
-              new Lambda[]{
-                  new Lambda(pkg, "MainKt$testStateless$6", 1) /* Banned for limited inlining */} :
-              new Lambda[]{
-                  new Lambda(pkg, "MainKt$testStateless$6", 1), /* Banned for limited inlining */
-                  new Lambda(pkg, "MainKt$testStateless$8", 2),
-                  new Lambda(pkg + "/inner", "InnerKt$testInnerStateless$7", 2)}
-
-      );
-    });
+          verifier.assertLambdas(
+              allowAccessModification
+                  ? new Lambda[] {}
+                  : new Lambda[] {
+                    new Lambda(pkg, "MainKt$testStateless$8", 2),
+                    new Lambda(pkg + "/inner", "InnerKt$testInnerStateless$7", 2)
+                  });
+        });
   }
 
   @Test
diff --git a/src/test/java/com/android/tools/r8/kotlin/KotlinxMetadataExtensionsServiceTest.java b/src/test/java/com/android/tools/r8/kotlin/KotlinxMetadataExtensionsServiceTest.java
index 87b9487..3eca971 100644
--- a/src/test/java/com/android/tools/r8/kotlin/KotlinxMetadataExtensionsServiceTest.java
+++ b/src/test/java/com/android/tools/r8/kotlin/KotlinxMetadataExtensionsServiceTest.java
@@ -31,7 +31,7 @@
 public class KotlinxMetadataExtensionsServiceTest extends TestBase {
 
   private void forkR8_kstyle_trivial(boolean allowAccessModification) throws Exception {
-    if  (!isRunR8Jar()) {
+    if (!isRunR8Jar()) {
       return;
     }
     Path working = temp.getRoot().toPath();
@@ -64,35 +64,34 @@
     Verifier verifier = new Verifier(inspector);
     String pkg = "lambdas_kstyle_trivial";
     verifier.assertLambdaGroups(
-        allowAccessModification ?
-            new Group[]{
-                kstyle("", 0, 4),
-                kstyle("", 1, 8),
-                kstyle("", 2, 2), // -\
-                kstyle("", 2, 5), // - 3 groups different by main method
-                kstyle("", 2, 4), // -/
-                kstyle("", 3, 2),
-                kstyle("", 22, 2)} :
-            new Group[]{
-                kstyle(pkg, 0, 2),
-                kstyle(pkg, 1, 4),
-                kstyle(pkg, 2, 5), // - 2 groups different by main method
-                kstyle(pkg, 2, 4), // -/
-                kstyle(pkg, 3, 2),
-                kstyle(pkg, 22, 2),
-                kstyle(pkg + "/inner", 0, 2),
-                kstyle(pkg + "/inner", 1, 4)}
-    );
+        allowAccessModification
+            ? new Group[] {
+              kstyle("", 0, 4),
+              kstyle("", 1, 9),
+              kstyle("", 2, 2), // -\
+              kstyle("", 2, 5), // - 3 groups different by main method
+              kstyle("", 2, 4), // -/
+              kstyle("", 3, 2),
+              kstyle("", 22, 2)
+            }
+            : new Group[] {
+              kstyle(pkg, 0, 2),
+              kstyle(pkg, 1, 5),
+              kstyle(pkg, 2, 5), // - 2 groups different by main method
+              kstyle(pkg, 2, 4), // -/
+              kstyle(pkg, 3, 2),
+              kstyle(pkg, 22, 2),
+              kstyle(pkg + "/inner", 0, 2),
+              kstyle(pkg + "/inner", 1, 4)
+            });
 
     verifier.assertLambdas(
-        allowAccessModification ?
-            new Lambda[]{
-                new Lambda(pkg, "MainKt$testStateless$6", 1) /* Banned for limited inlining */} :
-            new Lambda[]{
-                new Lambda(pkg, "MainKt$testStateless$6", 1), /* Banned for limited inlining */
-                new Lambda(pkg, "MainKt$testStateless$8", 2),
-                new Lambda(pkg + "/inner", "InnerKt$testInnerStateless$7", 2)}
-    );
+        allowAccessModification
+            ? new Lambda[] {}
+            : new Lambda[] {
+              new Lambda(pkg, "MainKt$testStateless$8", 2),
+              new Lambda(pkg + "/inner", "InnerKt$testInnerStateless$7", 2)
+            });
   }
 
   @Test
diff --git a/src/test/java/com/android/tools/r8/shaking/B112290098.java b/src/test/java/com/android/tools/r8/shaking/B112290098.java
index 502da76..e7784cc 100644
--- a/src/test/java/com/android/tools/r8/shaking/B112290098.java
+++ b/src/test/java/com/android/tools/r8/shaking/B112290098.java
@@ -8,7 +8,6 @@
 
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.utils.AndroidApp;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class B112290098 extends TestBase {
diff --git a/src/test/java/com/android/tools/r8/shaking/ifrule/inlining/IfRuleWithInlining.java b/src/test/java/com/android/tools/r8/shaking/ifrule/inlining/IfRuleWithInlining.java
index 4081836..d02fa5b 100644
--- a/src/test/java/com/android/tools/r8/shaking/ifrule/inlining/IfRuleWithInlining.java
+++ b/src/test/java/com/android/tools/r8/shaking/ifrule/inlining/IfRuleWithInlining.java
@@ -62,11 +62,10 @@
   @Parameters(name = "shrinker: {0} inlineMethod: {1}")
   public static Collection<Object[]> data() {
     // We don't run this on Proguard, as triggering inlining in Proguard is out of our control.
-    // TODO(b/64432527) Add configuration {Shrinker.R8_CF, true} when fixed. For now we fail to
-    // inline because of the exception handler.
     return ImmutableList.of(
         new Object[] {Shrinker.R8, true},
         new Object[] {Shrinker.R8, false},
+        new Object[] {Shrinker.R8_CF, true},
         new Object[] {Shrinker.R8_CF, false});
   }