Fix DCHECKs about clinit checks in Optimizing's code generators.
These assertions are not true for the baseline compiler. As
a temporary workaround, remove a clinit check as last input
of a static invoke if it is still present at the stage of
code generation.
Change-Id: I5655f4a0873e2e7ee7790b6a341c18b4b7b52af1
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 70e4440..f0c14f6 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -1195,8 +1195,12 @@
void LocationsBuilderX86::VisitInvokeStaticOrDirect(HInvokeStaticOrDirect* invoke) {
// Explicit clinit checks triggered by static invokes must have been
- // pruned by art::PrepareForRegisterAllocation.
- DCHECK(!invoke->IsStaticWithExplicitClinitCheck());
+ // pruned by art::PrepareForRegisterAllocation, but this step is not
+ // run in baseline. So we remove them manually here if we find them.
+ // TODO: Instead of this local workaround, address this properly.
+ if (invoke->IsStaticWithExplicitClinitCheck()) {
+ invoke->RemoveClinitCheckOrLoadClassAsLastInput();
+ }
IntrinsicLocationsBuilderX86 intrinsic(codegen_);
if (intrinsic.TryDispatch(invoke)) {