diff options
author | 2024-08-26 12:07:52 +0000 | |
---|---|---|
committer | 2024-08-27 15:22:50 +0000 | |
commit | 94dab79b1cb768088c254349cdf8a14419e69ed6 (patch) | |
tree | 08435eb4305c42ac16dc39579f0d2ebb07d449d1 /compiler/optimizing/superblock_cloner_test.cc | |
parent | 581f40f6612a2a2d31e9f91ffe50b7c362490af2 (diff) |
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
Diffstat (limited to 'compiler/optimizing/superblock_cloner_test.cc')
-rw-r--r-- | compiler/optimizing/superblock_cloner_test.cc | 15 |
1 files changed, 4 insertions, 11 deletions
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<HInstruction*> 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<HAdd>(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<HInstruction*> 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; |