Merge "Emit DebugLocalsChange before Goto"
diff --git a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
index 2f055ce..d02caf9 100644
--- a/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
+++ b/src/main/java/com/android/tools/r8/ir/regalloc/LinearScanRegisterAllocator.java
@@ -390,14 +390,10 @@
         // Compute the final change in locals and insert it before nextInstruction.
         boolean localsChanged = !ending.isEmpty() || !starting.isEmpty();
         if (localsChanged) {
-          boolean skipChange =
-              nextInstruction == nextInstruction.getBlock().exit() && nextInstruction.isGoto();
-          if (!skipChange) {
-            DebugLocalsChange change = createLocalsChange(ending, starting);
-            if (change != null) {
-              // Insert the DebugLocalsChange instruction before nextInstruction.
-              instructionIterator.add(change);
-            }
+          DebugLocalsChange change = createLocalsChange(ending, starting);
+          if (change != null) {
+            // Insert the DebugLocalsChange instruction before nextInstruction.
+            instructionIterator.add(change);
           }
           // Create new maps for the next DebugLocalsChange instruction.
           ending = new Int2ReferenceOpenHashMap<>();
diff --git a/src/test/java/com/android/tools/r8/cf/DebugInfoTestRunner.java b/src/test/java/com/android/tools/r8/cf/DebugInfoTestRunner.java
index ad6a72b..d6e0542 100644
--- a/src/test/java/com/android/tools/r8/cf/DebugInfoTestRunner.java
+++ b/src/test/java/com/android/tools/r8/cf/DebugInfoTestRunner.java
@@ -4,7 +4,6 @@
 package com.android.tools.r8.cf;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 import com.android.tools.r8.ClassFileConsumer;
 import com.android.tools.r8.CompilationMode;
@@ -14,8 +13,6 @@
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.ToolHelper;
 import com.android.tools.r8.ToolHelper.ProcessResult;
-import com.android.tools.r8.errors.CompilationError;
-import com.android.tools.r8.errors.InvalidDebugInfoException;
 import com.android.tools.r8.origin.Origin;
 import com.android.tools.r8.utils.ThrowingConsumer;
 import java.nio.file.Path;
@@ -36,18 +33,9 @@
     ProcessResult run1 = ToolHelper.runJava(out1, CLASS.getCanonicalName());
     assertEquals(runInput.toString(), run1.toString());
     Path out2 = temp.getRoot().toPath().resolve("out2.zip");
-    boolean invalidDebugInfo = false;
-    try {
-      build(builder -> builder.addProgramFiles(out1), new ClassFileConsumer.ArchiveConsumer(out2));
-    } catch (CompilationError e) {
-      invalidDebugInfo = e.getCause() instanceof InvalidDebugInfoException;
-    }
-    // TODO(b/77522100): Change to assertFalse when fixed.
-    assertTrue(invalidDebugInfo);
-    if (!invalidDebugInfo) {
-      ProcessResult run2 = ToolHelper.runJava(out2, CLASS.getCanonicalName());
-      assertEquals(runInput.toString(), run2.toString());
-    }
+    build(builder -> builder.addProgramFiles(out1), new ClassFileConsumer.ArchiveConsumer(out2));
+    ProcessResult run2 = ToolHelper.runJava(out2, CLASS.getCanonicalName());
+    assertEquals(runInput.toString(), run2.toString());
   }
 
   private void build(ThrowingConsumer<Builder, Exception> input, ProgramConsumer consumer)