Remove caching of array type lookups in graph lens

Bug: b/320707371
Change-Id: Ie14a40651e2b0cbb16f3d2f2a5f1dad9ccb0bd46
diff --git a/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java b/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
index 987bfe3..e657932 100644
--- a/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
+++ b/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
@@ -12,8 +12,6 @@
 import com.android.tools.r8.ir.code.InvokeType;
 import com.android.tools.r8.utils.ThrowingAction;
 import com.google.common.collect.Streams;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Predicate;
 
 public abstract class NonIdentityGraphLens extends GraphLens {
@@ -22,8 +20,6 @@
   private final DexItemFactory dexItemFactory;
   private GraphLens previousLens;
 
-  private final Map<DexType, DexType> arrayTypeCache = new ConcurrentHashMap<>();
-
   public NonIdentityGraphLens(AppView<?> appView) {
     this(appView, appView.graphLens());
   }
@@ -104,20 +100,14 @@
   }
 
   @Override
-  @SuppressWarnings("ReferenceEquality")
   public final DexType lookupType(DexType type, GraphLens appliedLens) {
     if (type.isClassType()) {
       return lookupClassType(type, appliedLens);
     }
     if (type.isArrayType()) {
-      DexType result = arrayTypeCache.get(type);
-      if (result == null) {
-        DexType baseType = type.toBaseType(dexItemFactory);
-        DexType newType = lookupType(baseType, appliedLens);
-        result = baseType == newType ? type : type.replaceBaseType(newType, dexItemFactory);
-        arrayTypeCache.put(type, result);
-      }
-      return result;
+      DexType baseType = type.toBaseType(dexItemFactory);
+      DexType newType = lookupType(baseType, appliedLens);
+      return baseType.isIdenticalTo(newType) ? type : type.replaceBaseType(newType, dexItemFactory);
     }
     assert type.isNullValueType() || type.isPrimitiveType() || type.isVoidType();
     return type;