Check if the type of an instruction is erroneous before inlining.

We can get HInstructions typed with a class that is in an error state.
For such classes, we cannot look at the vtable or imt table as they
are not cleanly populated.

bug:27683927

Change-Id: I0d64ca470e1cb6cf9b40e9f02bb9b0bb12c2bac1
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 573b583..440a282 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -144,6 +144,10 @@
   } else if (!resolved_method->GetDeclaringClass()->IsAssignableFrom(info.GetTypeHandle().Get())) {
     // The method that we're trying to call is not in the receiver's class or super classes.
     return nullptr;
+  } else if (info.GetTypeHandle()->IsErroneous()) {
+    // If the type is erroneous, do not go further, as we are going to query the vtable or
+    // imt table, that we can only safely do on non-erroneous classes.
+    return nullptr;
   }
 
   ClassLinker* cl = Runtime::Current()->GetClassLinker();