Clean up `InstructionSimplifierTest`.

Create a helper function for running the simplification pass
and put verbose logging behind a compile-time flag, disabled
by default.

Test: m test-art-host-gtest
Change-Id: I9405436a85cecdcfc151207ca9fcec4a98a920b7
diff --git a/compiler/optimizing/instruction_simplifier_test.cc b/compiler/optimizing/instruction_simplifier_test.cc
index d360953..966f5b9 100644
--- a/compiler/optimizing/instruction_simplifier_test.cc
+++ b/compiler/optimizing/instruction_simplifier_test.cc
@@ -33,6 +33,8 @@
 class Throwable;
 }  // namespace mirror
 
+static constexpr bool kDebugSimplifierTests = false;
+
 template<typename SuperClass>
 class InstructionSimplifierTestBase : public SuperClass, public OptimizingUnitTestHelper {
  public:
@@ -49,6 +51,19 @@
     SuperClass::TearDown();
     gLogVerbosity.compiler = false;
   }
+
+  void PerformSimplification(const AdjacencyListGraph& blks) {
+    if (kDebugSimplifierTests) {
+      LOG(INFO) << "Pre simplification " << blks;
+    }
+    graph_->ClearDominanceInformation();
+    graph_->BuildDominatorTree();
+    InstructionSimplifier simp(graph_, /*codegen=*/nullptr);
+    simp.Run();
+    if (kDebugSimplifierTests) {
+      LOG(INFO) << "Post simplify " << blks;
+    }
+  }
 };
 
 class InstructionSimplifierTest : public InstructionSimplifierTestBase<CommonCompilerTest> {};
@@ -197,13 +212,7 @@
 
   SetupExit(exit);
 
-  LOG(INFO) << "Pre simplification " << blks;
-  graph_->ClearDominanceInformation();
-  graph_->BuildDominatorTree();
-  InstructionSimplifier simp(graph_, /*codegen=*/nullptr);
-  simp.Run();
-
-  LOG(INFO) << "Post simplify " << blks;
+  PerformSimplification(blks);
 
   EXPECT_INS_RETAINED(read_end);
 
@@ -289,13 +298,7 @@
 
   SetupExit(exit);
 
-  LOG(INFO) << "Pre simplification " << blks;
-  graph_->ClearDominanceInformation();
-  graph_->BuildDominatorTree();
-  InstructionSimplifier simp(graph_, /*codegen=*/nullptr);
-  simp.Run();
-
-  LOG(INFO) << "Post simplify " << blks;
+  PerformSimplification(blks);
 
   EXPECT_FALSE(obj3->CanBeNull());
   EXPECT_INS_RETAINED(read_end);
@@ -373,13 +376,7 @@
 
   SetupExit(exit);
 
-  LOG(INFO) << "Pre simplification " << blks;
-  graph_->ClearDominanceInformation();
-  graph_->BuildDominatorTree();
-  InstructionSimplifier simp(graph_, /*codegen=*/nullptr);
-  simp.Run();
-
-  LOG(INFO) << "Post simplify " << blks;
+  PerformSimplification(blks);
 
   EXPECT_FALSE(obj1->CanBeNull());
   EXPECT_FALSE(obj2->CanBeNull());
@@ -464,16 +461,7 @@
 
   SetupExit(exit);
 
-  // PerformLSE expects this to be empty.
-  graph_->ClearDominanceInformation();
-
-  LOG(INFO) << "Pre simplification " << blks;
-  graph_->ClearDominanceInformation();
-  graph_->BuildDominatorTree();
-  InstructionSimplifier simp(graph_, /*codegen=*/nullptr);
-  simp.Run();
-
-  LOG(INFO) << "Post simplify " << blks;
+  PerformSimplification(blks);
 
   if (!GetConstantResult() || GetParam() == InstanceOfKind::kSelf) {
     EXPECT_INS_RETAINED(target_klass);
@@ -532,16 +520,7 @@
 
   SetupExit(exit);
 
-  // PerformLSE expects this to be empty.
-  graph_->ClearDominanceInformation();
-
-  LOG(INFO) << "Pre simplification " << blks;
-  graph_->ClearDominanceInformation();
-  graph_->BuildDominatorTree();
-  InstructionSimplifier simp(graph_, /*codegen=*/nullptr);
-  simp.Run();
-
-  LOG(INFO) << "Post simplify " << blks;
+  PerformSimplification(blks);
 
   if (!GetConstantResult() || GetParam() == InstanceOfKind::kSelf) {
     EXPECT_INS_RETAINED(target_klass);