ART: Clear use count for unused VRs.
The use count of temp VR should be cleared when we replace
"CMP_XXX vA, vB, vC" and "IF_XXX vA" with "kMirOpFusedCmpXXX vB, vC".
Otherwise, the backend may allocate a physical register for the unused vA.
Change-Id: I43ad37d0e7161ec3de154de8888caa94603f7715
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc
index 3c6b61d..fd4c3d7 100644
--- a/compiler/dex/mir_optimization.cc
+++ b/compiler/dex/mir_optimization.cc
@@ -526,6 +526,9 @@
default: LOG(ERROR) << "Unexpected opcode: " << opcode;
}
mir->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpNop);
+ // Clear use count of temp VR.
+ use_counts_[mir->ssa_rep->defs[0]] = 0;
+ raw_use_counts_[mir->ssa_rep->defs[0]] = 0;
// Copy the SSA information that is relevant.
mir_next->ssa_rep->num_uses = mir->ssa_rep->num_uses;
mir_next->ssa_rep->uses = mir->ssa_rep->uses;