summaryrefslogtreecommitdiff
path: root/compiler/optimizing/superblock_cloner_test.cc
diff options
context:
space:
mode:
author Evgeny Astigeevich <evgeny.astigeevich@linaro.org> 2019-12-04 15:59:37 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2019-12-13 07:12:02 +0000
commit52506e2a29b172a4e055ea545800e48b2ca508d5 (patch)
tree23599ea08495d98f6fdc6c9bf8e39719d3ac8632 /compiler/optimizing/superblock_cloner_test.cc
parent90ceea36a9c6ea123a5e1ad6b001230890406e2f (diff)
Add ImprovedOptimizingUnitTest::CreateParameters for subclasses
Subclasses of ImprovedOptimizingUnitTest might need a different number of graph parameters. Currently only a parameter is defined and created. This CL adds ImprovedOptimizingUnitTest::CreateParameters which subclasses can override to create as many parameters as they need. All created parameters are added to the entry basic block. The default implementation of ImprovedOptimizingUnitTest::CreateParameters does nothing. Test: run-gtests.sh Change-Id: I2c6a58232e36d3562fc2bc0cdc289dd739094a73
Diffstat (limited to 'compiler/optimizing/superblock_cloner_test.cc')
-rw-r--r--compiler/optimizing/superblock_cloner_test.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/optimizing/superblock_cloner_test.cc b/compiler/optimizing/superblock_cloner_test.cc
index aa19de683f..ddcf154f99 100644
--- a/compiler/optimizing/superblock_cloner_test.cc
+++ b/compiler/optimizing/superblock_cloner_test.cc
@@ -31,6 +31,14 @@ using HEdgeSet = SuperblockCloner::HEdgeSet;
// This class provides methods and helpers for testing various cloning and copying routines:
// individual instruction cloning and cloning of the more coarse-grain structures.
class SuperblockClonerTest : public ImprovedOptimizingUnitTest {
+ private:
+ void CreateParameters() override {
+ parameters_.push_back(new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
+ dex::TypeIndex(0),
+ 0,
+ DataType::Type::kInt32));
+ }
+
public:
void CreateBasicLoopControlFlow(HBasicBlock* position,
HBasicBlock* successor,
@@ -75,7 +83,7 @@ class SuperblockClonerTest : public ImprovedOptimizingUnitTest {
loop_header->AddInstruction(new (GetAllocator()) HIf(loop_check));
// Loop body block.
- HInstruction* null_check = new (GetAllocator()) HNullCheck(parameter_, dex_pc);
+ HInstruction* null_check = new (GetAllocator()) HNullCheck(parameters_[0], dex_pc);
HInstruction* array_length = new (GetAllocator()) HArrayLength(null_check, dex_pc);
HInstruction* bounds_check = new (GetAllocator()) HBoundsCheck(phi, array_length, dex_pc);
HInstruction* array_get =
@@ -100,7 +108,7 @@ class SuperblockClonerTest : public ImprovedOptimizingUnitTest {
graph_->SetHasBoundsChecks(true);
// Adjust HEnvironment for each instruction which require that.
- ArenaVector<HInstruction*> current_locals({phi, const_128, parameter_},
+ ArenaVector<HInstruction*> current_locals({phi, const_128, parameters_[0]},
GetAllocator()->Adapter(kArenaAllocInstruction));
HEnvironment* env = ManuallyBuildEnvFor(suspend_check, &current_locals);
@@ -421,7 +429,7 @@ TEST_F(SuperblockClonerTest, LoopPeelingMultipleBackEdges) {
if_block->AddSuccessor(temp1);
temp1->AddSuccessor(header);
- if_block->AddInstruction(new (GetAllocator()) HIf(parameter_));
+ if_block->AddInstruction(new (GetAllocator()) HIf(parameters_[0]));
HInstructionIterator it(header->GetPhis());
DCHECK(!it.Done());
@@ -586,7 +594,7 @@ TEST_F(SuperblockClonerTest, NestedCaseExitToOutermost) {
// Change the loop3 - insert an exit which leads to loop1.
HBasicBlock* loop3_extra_if_block = new (GetAllocator()) HBasicBlock(graph_);
graph_->AddBlock(loop3_extra_if_block);
- loop3_extra_if_block->AddInstruction(new (GetAllocator()) HIf(parameter_));
+ loop3_extra_if_block->AddInstruction(new (GetAllocator()) HIf(parameters_[0]));
loop3_header->ReplaceSuccessor(loop_body3, loop3_extra_if_block);
loop3_extra_if_block->AddSuccessor(loop_body1); // Long exit.