Do not do a type check when setting null to an array.
Change-Id: I7387d45aea697d4a3de273335647220a815a992b
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 6c82fe9..931d751 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -3856,7 +3856,7 @@
} else {
DCHECK(value.IsConstant()) << value;
__ movl(Address(obj, offset),
- Immediate(value.GetConstant()->AsIntConstant()->GetValue()));
+ Immediate(CodeGenerator::GetInt32ValueOf(value.GetConstant())));
}
} else {
DCHECK(index.IsRegister()) << index;
@@ -3866,7 +3866,7 @@
} else {
DCHECK(value.IsConstant()) << value;
__ movl(Address(obj, index.AsRegister<Register>(), TIMES_4, data_offset),
- Immediate(value.GetConstant()->AsIntConstant()->GetValue()));
+ Immediate(CodeGenerator::GetInt32ValueOf(value.GetConstant())));
}
}
codegen_->MaybeRecordImplicitNullCheck(instruction);
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index e375f7b..62f90c2 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -398,6 +398,10 @@
}
}
+ if (value->IsNullConstant()) {
+ instruction->ClearNeedsTypeCheck();
+ }
+
if (!value->CanBeNull()) {
instruction->ClearValueCanBeNull();
}