Allow devirtualized method to be intrinsified.

For a invocation that's devirtualized to a different method, try
to give intrinsics matching an opportunity before trying to inline it.

Test: run-test on host. 638-checker-inline-cache-intrinsic.
Change-Id: I51f70835db4c07575c58872a64a603a38dbcb89c
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index 7fa0c2b..089e41b 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -2035,7 +2035,9 @@
       optimizations.SetArgumentIsString();
     } else if (kUseReadBarrier) {
       DCHECK(instruction->GetResolvedMethod() != nullptr);
-      DCHECK(instruction->GetResolvedMethod()->GetDeclaringClass()->IsStringClass());
+      DCHECK(instruction->GetResolvedMethod()->GetDeclaringClass()->IsStringClass() ||
+             // Object.equals() can be devirtualized to String.equals().
+             instruction->GetResolvedMethod()->GetDeclaringClass()->IsObjectClass());
       Runtime* runtime = Runtime::Current();
       // For AOT, we always assume that the boot image shall contain the String.class and
       // we do not need a read barrier for boot image classes as they are non-moveable.