From e05bc3e1d03e8cba0c16a1b738591a2e972235b6 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Mon, 20 Feb 2023 14:26:23 +0000 Subject: 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 --- compiler/optimizing/nodes.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/nodes.cc') diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 0876ce070e..c99cfab05f 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -688,7 +688,7 @@ void HGraph::TransformLoopToSinglePreheaderFormat(HBasicBlock* header) { 0, header_phi->GetType()); if (header_phi->GetType() == DataType::Type::kReference) { - preheader_phi->SetReferenceTypeInfo(header_phi->GetReferenceTypeInfo()); + preheader_phi->SetReferenceTypeInfoIfValid(header_phi->GetReferenceTypeInfo()); } preheader->AddPhi(preheader_phi); @@ -3215,6 +3215,12 @@ void HInstruction::SetReferenceTypeInfo(ReferenceTypeInfo rti) { SetPackedFlag(rti.IsExact()); } +void HInstruction::SetReferenceTypeInfoIfValid(ReferenceTypeInfo rti) { + if (rti.IsValid()) { + SetReferenceTypeInfo(rti); + } +} + bool HBoundType::InstructionDataEquals(const HInstruction* other) const { const HBoundType* other_bt = other->AsBoundType(); ScopedObjectAccess soa(Thread::Current()); -- cgit v1.2.3-59-g8ed1b