Tweak handling of arguments when argument register reuse is disabled.

If there are multiple uses of an argument value, split it right after
its definition instead of at the first use. This makes it more likely
that arguments get in useful registers initially and reduces the
amount of argument moves needed.

This reduces the GMSCore v10 debug build size by 20kB and reduces
a simple debug dex file size from 15kB to 13kB.

R=zerny@google.com

Bug: 38375244
Change-Id: Ibfe45500a87c73a91dad6bbcfdb048dd590e5efb
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 f621c67..7103abe 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
@@ -555,7 +555,17 @@
         if (argumentInterval.getUses().size() > 1) {
           LiveIntervalsUse use = argumentInterval.firstUseWithConstraint();
           if (use != null) {
-            LiveIntervals split = argumentInterval.splitBefore(use.getPosition());
+            LiveIntervals split;
+            if (argumentInterval.getUses().size() == 2) {
+              // If there is only one real use (definition plus one real use), split before
+              // that one use.
+              split = argumentInterval.splitBefore(use.getPosition());
+            } else {
+              // If there are multiple real users, split right after the definition to make it
+              // more likely that arguments get in usable registers from the start.
+              split = argumentInterval
+                  .splitBefore(argumentInterval.getValue().definition.getNumber() + 1);
+            }
             unhandled.add(split);
           }
         }