From 94dab79b1cb768088c254349cdf8a14419e69ed6 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Mon, 26 Aug 2024 12:07:52 +0000 Subject: ART: Clean up environment construction in gtests. Create required instruction environments in helper functions that create instructions. Test: m test-art-host-gtest Change-Id: Iacdd3c3717d95bc3e7fc3c1b676bc8eb70f2e6bc --- compiler/optimizing/superblock_cloner_test.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'compiler/optimizing/superblock_cloner_test.cc') diff --git a/compiler/optimizing/superblock_cloner_test.cc b/compiler/optimizing/superblock_cloner_test.cc index 4a61e45021..5190dae033 100644 --- a/compiler/optimizing/superblock_cloner_test.cc +++ b/compiler/optimizing/superblock_cloner_test.cc @@ -49,14 +49,15 @@ class SuperblockClonerTest : public OptimizingUnitTest { // Header block. auto [phi, induction_inc] = MakeLinearLoopVar(loop_header, loop_body, const_0, const_1); - HInstruction* suspend_check = MakeSuspendCheck(loop_header); + std::initializer_list common_env{phi, const_128, param_}; + HInstruction* suspend_check = MakeSuspendCheck(loop_header, common_env); HInstruction* loop_check = MakeCondition(loop_header, kCondGE, phi, const_128); MakeIf(loop_header, loop_check); // Loop body block. - HInstruction* null_check = MakeNullCheck(loop_body, param_, dex_pc); + HInstruction* null_check = MakeNullCheck(loop_body, param_, common_env, dex_pc); HInstruction* array_length = MakeArrayLength(loop_body, null_check, dex_pc); - HInstruction* bounds_check = MakeBoundsCheck(loop_body, phi, array_length, dex_pc); + HInstruction* bounds_check = MakeBoundsCheck(loop_body, phi, array_length, common_env, dex_pc); HInstruction* array_get = MakeArrayGet(loop_body, null_check, bounds_check, DataType::Type::kInt32, dex_pc); HInstruction* add = MakeBinOp(loop_body, DataType::Type::kInt32, array_get, const_1); @@ -64,14 +65,6 @@ class SuperblockClonerTest : public OptimizingUnitTest { MakeArraySet(loop_body, null_check, bounds_check, add, DataType::Type::kInt32, dex_pc); graph_->SetHasBoundsChecks(true); - - // Adjust HEnvironment for each instruction which require that. - ArenaVector current_locals({phi, const_128, param_}, - GetAllocator()->Adapter(kArenaAllocInstruction)); - - HEnvironment* env = ManuallyBuildEnvFor(suspend_check, ¤t_locals); - null_check->CopyEnvironmentFrom(env); - bounds_check->CopyEnvironmentFrom(env); } HParameterValue* param_ = nullptr; -- cgit v1.2.3-59-g8ed1b