diff options
author | 2023-02-20 14:26:23 +0000 | |
---|---|---|
committer | 2023-02-22 11:47:48 +0000 | |
commit | e05bc3e1d03e8cba0c16a1b738591a2e972235b6 (patch) | |
tree | c5c8e4342b31ad445c0c80cf08cf671dc598e33e /compiler/optimizing/dead_code_elimination.cc | |
parent | 452605be671e499ae2c535f7c7a37587551dc65a (diff) |
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
Diffstat (limited to 'compiler/optimizing/dead_code_elimination.cc')
-rw-r--r-- | compiler/optimizing/dead_code_elimination.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/optimizing/dead_code_elimination.cc b/compiler/optimizing/dead_code_elimination.cc index 5437d9bd93..cf49e39849 100644 --- a/compiler/optimizing/dead_code_elimination.cc +++ b/compiler/optimizing/dead_code_elimination.cc @@ -181,6 +181,13 @@ static bool RemoveNonNullControlDependences(HBasicBlock* block, HBasicBlock* thr } else if (!cond->InputAt(0)->IsNullConstant()) { return false; } + + // We can't create a BoundType for an object with an invalid RTI. + const ReferenceTypeInfo ti = obj->GetReferenceTypeInfo(); + if (!ti.IsValid()) { + return false; + } + // Scan all uses of obj and find null check under control dependence. HBoundType* bound = nullptr; const HUseList<HInstruction*>& uses = obj->GetUses(); @@ -193,7 +200,6 @@ static bool RemoveNonNullControlDependences(HBasicBlock* block, HBasicBlock* thr user_block != throws && block->Dominates(user_block)) { if (bound == nullptr) { - ReferenceTypeInfo ti = obj->GetReferenceTypeInfo(); bound = new (obj->GetBlock()->GetGraph()->GetAllocator()) HBoundType(obj); bound->SetUpperBound(ti, /*can_be_null*/ false); bound->SetReferenceTypeInfo(ti); |