Optimizing: Run gtests without creating the Runtime.
The only Optimizing test that actually needs a Runtime is
the ReferenceTypePropagationTest, so we make it subclass
CommonCompilerTest explicitly and change OptimizingUnitTest
to subclass CommonArtTest for the other tests.
On host, each test that initializes the Runtime takes ~220ms
more than without initializing the Runtime. For example, the
ConstantFoldingTest that has 10 individual tests previously
took over 2.2s to run but without the Runtime initialization
it takes around 3-5ms. On target, running 32-bit gtests on
taimen with run-gtests.sh (single-threaded) goes from
~28m47s to ~26m13s, a reduction of ~9%.
Test: m test-art-host-gtest
Test: run-gtests.sh
Change-Id: I43e50ed58e52cc0ad04cdb4d39801bfbae840a3d
diff --git a/compiler/optimizing/loop_optimization_test.cc b/compiler/optimizing/loop_optimization_test.cc
index 8b4d58e..bda2528 100644
--- a/compiler/optimizing/loop_optimization_test.cc
+++ b/compiler/optimizing/loop_optimization_test.cc
@@ -15,6 +15,7 @@
*/
#include "code_generator.h"
+#include "driver/compiler_options.h"
#include "loop_optimization.h"
#include "optimizing_unit_test.h"
@@ -28,12 +29,12 @@
class LoopOptimizationTest : public OptimizingUnitTest {
protected:
void SetUp() override {
- OverrideInstructionSetFeatures(instruction_set_, "default");
OptimizingUnitTest::SetUp();
graph_ = CreateGraph();
BuildGraph();
iva_ = new (GetAllocator()) HInductionVarAnalysis(graph_);
+ compiler_options_ = CommonCompilerTest::CreateCompilerOptions(kRuntimeISA, "default");
DCHECK(compiler_options_ != nullptr);
codegen_ = CodeGenerator::Create(graph_, *compiler_options_);
DCHECK(codegen_.get() != nullptr);
@@ -43,6 +44,7 @@
void TearDown() override {
codegen_.reset();
+ compiler_options_.reset();
graph_ = nullptr;
ResetPoolAndAllocator();
OptimizingUnitTest::TearDown();
@@ -117,6 +119,7 @@
// General building fields.
HGraph* graph_;
+ std::unique_ptr<CompilerOptions> compiler_options_;
std::unique_ptr<CodeGenerator> codegen_;
HInductionVarAnalysis* iva_;
HLoopOptimization* loop_opt_;