ART: Promoted register may be wrong after the load of zero fp constant

Because of Dalvik byte code's lack of immediate typing,
the same vreg may be used in core, ref and fp operations.
To properly support GC, we must ensure that if a constant zero is loaded
into a fp view of a vreg, it must also be loaded into the core/ref view.
The code that was responsible for ensuring this failed to handle the case
of a vreg having a non-promoted fp view and a promoted core/ref view.

Change-Id: If77295aa93317e749ceacc8c1dd9e582122c368f
Signed-off-by: Vladimir <vladimir.a.ivanov@intel.com>
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
diff --git a/compiler/dex/quick/gen_loadstore.cc b/compiler/dex/quick/gen_loadstore.cc
index 9f36e35..db844bc 100644
--- a/compiler/dex/quick/gen_loadstore.cc
+++ b/compiler/dex/quick/gen_loadstore.cc
@@ -44,7 +44,9 @@
 void Mir2Lir::Workaround7250540(RegLocation rl_dest, RegStorage zero_reg) {
   if (rl_dest.fp) {
     int pmap_index = SRegToPMap(rl_dest.s_reg_low);
-    if (promotion_map_[pmap_index].fp_location == kLocPhysReg) {
+    const bool is_fp_promoted = promotion_map_[pmap_index].fp_location == kLocPhysReg;
+    const bool is_core_promoted = promotion_map_[pmap_index].core_location == kLocPhysReg;
+    if (is_fp_promoted || is_core_promoted) {
       // Now, determine if this vreg is ever used as a reference.  If not, we're done.
       bool used_as_reference = false;
       int base_vreg = mir_graph_->SRegToVReg(rl_dest.s_reg_low);
@@ -61,7 +63,7 @@
         temp_reg = AllocTemp();
         LoadConstant(temp_reg, 0);
       }
-      if (promotion_map_[pmap_index].core_location == kLocPhysReg) {
+      if (is_core_promoted) {
         // Promoted - just copy in a zero
         OpRegCopy(RegStorage::Solo32(promotion_map_[pmap_index].core_reg), temp_reg);
       } else {