diff options
Diffstat (limited to 'compiler/optimizing/loop_optimization_test.cc')
-rw-r--r-- | compiler/optimizing/loop_optimization_test.cc | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/compiler/optimizing/loop_optimization_test.cc b/compiler/optimizing/loop_optimization_test.cc index 310d98b5b0..8b4d58eaae 100644 --- a/compiler/optimizing/loop_optimization_test.cc +++ b/compiler/optimizing/loop_optimization_test.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include "code_generator.h" #include "loop_optimization.h" #include "optimizing_unit_test.h" @@ -25,16 +26,29 @@ namespace art { * through the checker tests. */ class LoopOptimizationTest : public OptimizingUnitTest { - public: - LoopOptimizationTest() - : graph_(CreateGraph()), - iva_(new (GetAllocator()) HInductionVarAnalysis(graph_)), - loop_opt_(new (GetAllocator()) HLoopOptimization( - graph_, /* compiler_options= */ nullptr, iva_, /* stats= */ nullptr)) { + protected: + void SetUp() override { + OverrideInstructionSetFeatures(instruction_set_, "default"); + OptimizingUnitTest::SetUp(); + + graph_ = CreateGraph(); BuildGraph(); + iva_ = new (GetAllocator()) HInductionVarAnalysis(graph_); + DCHECK(compiler_options_ != nullptr); + codegen_ = CodeGenerator::Create(graph_, *compiler_options_); + DCHECK(codegen_.get() != nullptr); + loop_opt_ = new (GetAllocator()) HLoopOptimization( + graph_, *codegen_.get(), iva_, /* stats= */ nullptr); + } + + void TearDown() override { + codegen_.reset(); + graph_ = nullptr; + ResetPoolAndAllocator(); + OptimizingUnitTest::TearDown(); } - ~LoopOptimizationTest() { } + virtual ~LoopOptimizationTest() {} /** Constructs bare minimum graph. */ void BuildGraph() { @@ -102,6 +116,8 @@ class LoopOptimizationTest : public OptimizingUnitTest { // General building fields. HGraph* graph_; + + std::unique_ptr<CodeGenerator> codegen_; HInductionVarAnalysis* iva_; HLoopOptimization* loop_opt_; |