Set more RTI only if they are valid
Follow-up to aosp/2442280. We haven't seen crashes with these ones,
but we can't guarantee that the RTI will be valid in these code paths.
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I80da85a6549ba0275a80027016363e0cf9fb8045
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index 86b9dba..12ca30f 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -970,7 +970,7 @@
pred_get->GetFieldInfo().GetDexFile(),
pred_get->GetDexPc());
if (pred_get->GetType() == DataType::Type::kReference) {
- replace_with->SetReferenceTypeInfo(pred_get->GetReferenceTypeInfo());
+ replace_with->SetReferenceTypeInfoIfValid(pred_get->GetReferenceTypeInfo());
}
pred_get->GetBlock()->InsertInstructionBefore(replace_with, pred_get);
pred_get->ReplaceWith(replace_with);
@@ -2782,7 +2782,7 @@
ArenaAllocator* allocator = block->GetGraph()->GetAllocator();
HStringBuilderAppend* append = new (allocator) HStringBuilderAppend(
fmt, num_args, has_fp_args, allocator, invoke->GetDexPc());
- append->SetReferenceTypeInfo(invoke->GetReferenceTypeInfo());
+ append->SetReferenceTypeInfoIfValid(invoke->GetReferenceTypeInfo());
for (size_t i = 0; i != num_args; ++i) {
append->SetArgumentAt(i, args[num_args - 1u - i]);
}