Fix CopyRegInfo to keep live/dirty flags of new registers.
CopyRegInfo should not change live/dirty flags of new registgers.
Otherwise, it will lead to incorrectly clobbering these live registers
that are not live actually, and then allocating them to another usage.
Change-Id: Ia9f055b33a11a6d70c0aca1a9fe8639ecfb09464
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
diff --git a/compiler/dex/quick/ralloc_util.cc b/compiler/dex/quick/ralloc_util.cc
index 137d5eb..39783a2 100644
--- a/compiler/dex/quick/ralloc_util.cc
+++ b/compiler/dex/quick/ralloc_util.cc
@@ -743,11 +743,15 @@
void Mir2Lir::CopyRegInfo(int new_reg, int old_reg) {
RegisterInfo* new_info = GetRegInfo(new_reg);
RegisterInfo* old_info = GetRegInfo(old_reg);
- // Target temp status must not change
+ // Target temp, live, dirty status must not change
bool is_temp = new_info->is_temp;
+ bool live = new_info->live;
+ bool dirty = new_info->dirty;
*new_info = *old_info;
- // Restore target's temp status
+ // Restore target's temp, live, dirty status
new_info->is_temp = is_temp;
+ new_info->live = live;
+ new_info->dirty = dirty;
new_info->reg = new_reg;
}