From bb550e415da77e7e21c8f800657984c145bb42e1 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Wed, 21 Apr 2021 17:04:13 -0700 Subject: Fix issue with Partial LSE and casts/instanceof If PartialLSE encounters an instanceof or check-cast before the escapes it could not correctly handle it. Due to how java language code is typically developed and compiled this is generally not a problem but could lead to incorrect codegen on release builds or DCHECK failures on debug builds. This fixes the issues by (1) causing partial LSE to consider check-cast and instance-ofs to be escaping. This also updates the instruction simplifier to be much more aggressive in removing instance-of and check-casts. Test: ./test.py --host Bug: 186041085 Change-Id: Ia513c4210a87a0dfa92f10adc530e17ee631d006 --- compiler/optimizing/optimizing_unit_test.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/optimizing_unit_test.h') diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h index 12c1b9879f..6600ff319a 100644 --- a/compiler/optimizing/optimizing_unit_test.h +++ b/compiler/optimizing/optimizing_unit_test.h @@ -406,11 +406,12 @@ class OptimizingUnitTestHelper { OptimizingUnitTestHelper::ManuallyBuildEnvFor(ins, ¤t_locals); } - HLoadClass* MakeClassLoad(std::optional ti = std::nullopt) { + HLoadClass* MakeClassLoad(std::optional ti = std::nullopt, + std::optional> klass = std::nullopt) { return new (GetAllocator()) HLoadClass(graph_->GetCurrentMethod(), ti ? *ti : dex::TypeIndex(class_idx_++), graph_->GetDexFile(), - /* klass= */ null_klass_, + /* klass= */ klass ? *klass : null_klass_, /* is_referrers_class= */ false, /* dex_pc= */ 0, /* needs_access_check= */ false); -- cgit v1.2.3-59-g8ed1b