Reduce the number of explicit clinit checks for static invokes.

Do not generate explicit clinit checks for static invokes
when the class of the called method is a super class of the
caller method's class (referrer class).

Change-Id: I86ba18facef261fbb71f7ed20867756630ed3c53
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index bb20807..2f8a605 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -666,9 +666,10 @@
                                                                    &storage_index);
       }
 
-      if (is_referrer_class) {
-        // If the declaring class is the referrer class, no class
-        // initialization is needed before the static method call.
+      if (referrer_class.Get()->IsSubClass(resolved_method->GetDeclaringClass())) {
+        // If the referrer class is the declaring class or a subclass
+        // of the declaring class, no class initialization is needed
+        // before the static method call.
         clinit_check_requirement = HInvokeStaticOrDirect::ClinitCheckRequirement::kNone;
       } else if (storage_index != DexFile::kDexNoIndex) {
         // If the method's class type index is available, check