Optimizing: Refactor ImprovedOptimizingUnitTest.

And merge all functionality into OptimizingUnitTest.

Test: m test-art-host-gtest
Change-Id: I69a4e8c489462700ec0eb9ed93d5cdbdb6147f1a
diff --git a/compiler/optimizing/select_generator_test.cc b/compiler/optimizing/select_generator_test.cc
index 6e68c6c..b18d41a 100644
--- a/compiler/optimizing/select_generator_test.cc
+++ b/compiler/optimizing/select_generator_test.cc
@@ -24,24 +24,20 @@
 
 namespace art {
 
-class SelectGeneratorTest : public ImprovedOptimizingUnitTest {
- private:
-  void CreateParameters() override {
-    parameters_.push_back(new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
-                                                               dex::TypeIndex(0),
-                                                               0,
-                                                               DataType::Type::kInt32));
+class SelectGeneratorTest : public OptimizingUnitTest {
+ protected:
+  void InitGraphAndParameters() {
+    InitGraph();
+    AddParameter(new (GetAllocator()) HParameterValue(graph_->GetDexFile(),
+                                                      dex::TypeIndex(0),
+                                                      0,
+                                                      DataType::Type::kInt32));
   }
 
- public:
   void ConstructBasicGraphForSelect(HInstruction* instr) {
-    HBasicBlock* if_block = new (GetAllocator()) HBasicBlock(graph_);
-    HBasicBlock* then_block = new (GetAllocator()) HBasicBlock(graph_);
-    HBasicBlock* else_block = new (GetAllocator()) HBasicBlock(graph_);
-
-    graph_->AddBlock(if_block);
-    graph_->AddBlock(then_block);
-    graph_->AddBlock(else_block);
+    HBasicBlock* if_block = AddNewBlock();
+    HBasicBlock* then_block = AddNewBlock();
+    HBasicBlock* else_block = AddNewBlock();
 
     entry_block_->ReplaceSuccessor(return_block_, if_block);
 
@@ -82,7 +78,7 @@
 
 // HDivZeroCheck might throw and should not be hoisted from the conditional to an unconditional.
 TEST_F(SelectGeneratorTest, testZeroCheck) {
-  InitGraph();
+  InitGraphAndParameters();
   HDivZeroCheck* instr = new (GetAllocator()) HDivZeroCheck(parameters_[0], 0);
   ConstructBasicGraphForSelect(instr);
 
@@ -95,7 +91,7 @@
 
 // Test that SelectGenerator succeeds with HAdd.
 TEST_F(SelectGeneratorTest, testAdd) {
-  InitGraph();
+  InitGraphAndParameters();
   HAdd* instr = new (GetAllocator()) HAdd(DataType::Type::kInt32,
                                           parameters_[0],
                                           parameters_[0], 0);