Fix build breakage after GVN change.

Change-Id: I120717f8cae452cad9967559c466c1605a3e7b14
diff --git a/compiler/optimizing/bounds_check_elimination_test.cc b/compiler/optimizing/bounds_check_elimination_test.cc
index f650ff2..d5de3ef 100644
--- a/compiler/optimizing/bounds_check_elimination_test.cc
+++ b/compiler/optimizing/bounds_check_elimination_test.cc
@@ -25,6 +25,12 @@
 
 namespace art {
 
+static void RunGvn(HGraph* graph) {
+  SideEffectsAnalysis side_effects(graph);
+  side_effects.Run();
+  GlobalValueNumberer(graph->GetArena(), graph, side_effects).Run();
+}
+
 // if (i < 0) { array[i] = 1; // Can't eliminate. }
 // else if (i >= array.length) { array[i] = 1; // Can't eliminate. }
 // else { array[i] = 1; // Can eliminate. }
@@ -120,7 +126,7 @@
   block3->AddSuccessor(block4);  // False successor
 
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination(graph);
   bounds_check_elimination.Run();
   ASSERT_FALSE(IsRemoved(bounds_check2));
@@ -195,7 +201,7 @@
   block3->AddSuccessor(exit);
 
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination(graph);
   bounds_check_elimination.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -270,7 +276,7 @@
   block3->AddSuccessor(exit);
 
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination(graph);
   bounds_check_elimination.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -344,7 +350,7 @@
   exit->AddInstruction(new (&allocator) HExit());
 
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination(graph);
   bounds_check_elimination.Run();
   ASSERT_FALSE(IsRemoved(bounds_check5));
@@ -443,7 +449,7 @@
   // HArrayLength which uses the null check as its input.
   graph = BuildSSAGraph1(&allocator, &bounds_check, 0, 1);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_after_gvn(graph);
   bounds_check_elimination_after_gvn.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -451,7 +457,7 @@
   // for (int i=1; i<array.length; i++) { array[i] = 10; // Can eliminate. }
   graph = BuildSSAGraph1(&allocator, &bounds_check, 1, 1);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_initial_1(graph);
   bounds_check_elimination_with_initial_1.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -459,7 +465,7 @@
   // for (int i=-1; i<array.length; i++) { array[i] = 10; // Can't eliminate. }
   graph = BuildSSAGraph1(&allocator, &bounds_check, -1, 1);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_initial_minus_1(graph);
   bounds_check_elimination_with_initial_minus_1.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -467,7 +473,7 @@
   // for (int i=0; i<=array.length; i++) { array[i] = 10; // Can't eliminate. }
   graph = BuildSSAGraph1(&allocator, &bounds_check, 0, 1, kCondGT);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_greater_than(graph);
   bounds_check_elimination_with_greater_than.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -476,7 +482,7 @@
   //   array[i] = 10; // Can't eliminate due to overflow concern. }
   graph = BuildSSAGraph1(&allocator, &bounds_check, 0, 2);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_increment_2(graph);
   bounds_check_elimination_with_increment_2.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -484,7 +490,7 @@
   // for (int i=1; i<array.length; i += 2) { array[i] = 10; // Can eliminate. }
   graph = BuildSSAGraph1(&allocator, &bounds_check, 1, 2);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_increment_2_from_1(graph);
   bounds_check_elimination_with_increment_2_from_1.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -584,7 +590,7 @@
   // HArrayLength which uses the null check as its input.
   graph = BuildSSAGraph2(&allocator, &bounds_check, 0);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_after_gvn(graph);
   bounds_check_elimination_after_gvn.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -592,7 +598,7 @@
   // for (int i=array.length; i>1; i--) { array[i-1] = 10; // Can eliminate. }
   graph = BuildSSAGraph2(&allocator, &bounds_check, 1);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_initial_1(graph);
   bounds_check_elimination_with_initial_1.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -600,7 +606,7 @@
   // for (int i=array.length; i>-1; i--) { array[i-1] = 10; // Can't eliminate. }
   graph = BuildSSAGraph2(&allocator, &bounds_check, -1);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_initial_minus_1(graph);
   bounds_check_elimination_with_initial_minus_1.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -608,7 +614,7 @@
   // for (int i=array.length; i>=0; i--) { array[i-1] = 10; // Can't eliminate. }
   graph = BuildSSAGraph2(&allocator, &bounds_check, 0, -1, kCondLT);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_less_than(graph);
   bounds_check_elimination_with_less_than.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -616,7 +622,7 @@
   // for (int i=array.length; i>0; i-=2) { array[i-1] = 10; // Can eliminate. }
   graph = BuildSSAGraph2(&allocator, &bounds_check, 0, -2);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_increment_minus_2(graph);
   bounds_check_elimination_increment_minus_2.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -703,7 +709,7 @@
   HInstruction* bounds_check = nullptr;
   HGraph* graph = BuildSSAGraph3(&allocator, &bounds_check, 0, 1, kCondGE);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_after_gvn(graph);
   bounds_check_elimination_after_gvn.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -712,7 +718,7 @@
   // for (int i=1; i<10; i++) { array[i] = 10; // Can eliminate. }
   graph = BuildSSAGraph3(&allocator, &bounds_check, 1, 1, kCondGE);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_initial_1(graph);
   bounds_check_elimination_with_initial_1.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -721,7 +727,7 @@
   // for (int i=0; i<=10; i++) { array[i] = 10; // Can't eliminate. }
   graph = BuildSSAGraph3(&allocator, &bounds_check, 0, 1, kCondGT);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_greater_than(graph);
   bounds_check_elimination_with_greater_than.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -730,7 +736,7 @@
   // for (int i=1; i<10; i+=8) { array[i] = 10; // Can eliminate. }
   graph = BuildSSAGraph3(&allocator, &bounds_check, 1, 8, kCondGE);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_increment_8(graph);
   bounds_check_elimination_increment_8.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -831,7 +837,7 @@
   // HArrayLength which uses the null check as its input.
   graph = BuildSSAGraph4(&allocator, &bounds_check, 0);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_after_gvn(graph);
   bounds_check_elimination_after_gvn.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -839,7 +845,7 @@
   // for (int i=1; i<array.length; i++) { array[array.length-i-1] = 10; // Can eliminate. }
   graph = BuildSSAGraph4(&allocator, &bounds_check, 1);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_initial_1(graph);
   bounds_check_elimination_with_initial_1.Run();
   ASSERT_TRUE(IsRemoved(bounds_check));
@@ -847,7 +853,7 @@
   // for (int i=0; i<=array.length; i++) { array[array.length-i] = 10; // Can't eliminate. }
   graph = BuildSSAGraph4(&allocator, &bounds_check, 0, kCondGT);
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   BoundsCheckElimination bounds_check_elimination_with_greater_than(graph);
   bounds_check_elimination_with_greater_than.Run();
   ASSERT_FALSE(IsRemoved(bounds_check));
@@ -1023,7 +1029,7 @@
   outer_body_add->AddSuccessor(outer_header);
 
   graph->BuildDominatorTree();
-  GlobalValueNumberer(&allocator, graph).Run();
+  RunGvn(graph);
   // gvn should remove the same bounds check.
   ASSERT_FALSE(IsRemoved(bounds_check1));
   ASSERT_FALSE(IsRemoved(bounds_check2));
diff --git a/compiler/optimizing/gvn_test.cc b/compiler/optimizing/gvn_test.cc
index 48f1ea9..9e630a7 100644
--- a/compiler/optimizing/gvn_test.cc
+++ b/compiler/optimizing/gvn_test.cc
@@ -64,7 +64,9 @@
   ASSERT_EQ(use_after_kill->GetBlock(), block);
 
   graph->TryBuildingSsa();
-  GlobalValueNumberer(&allocator, graph).Run();
+  SideEffectsAnalysis side_effects(graph);
+  side_effects.Run();
+  GlobalValueNumberer(&allocator, graph, side_effects).Run();
 
   ASSERT_TRUE(to_remove->GetBlock() == nullptr);
   ASSERT_EQ(different_offset->GetBlock(), block);
@@ -116,7 +118,9 @@
   join->AddInstruction(new (&allocator) HExit());
 
   graph->TryBuildingSsa();
-  GlobalValueNumberer(&allocator, graph).Run();
+  SideEffectsAnalysis side_effects(graph);
+  side_effects.Run();
+  GlobalValueNumberer(&allocator, graph, side_effects).Run();
 
   // Check that all field get instructions have been GVN'ed.
   ASSERT_TRUE(then->GetFirstInstruction()->IsGoto());
@@ -184,7 +188,11 @@
   ASSERT_EQ(field_get_in_exit->GetBlock(), exit);
 
   graph->TryBuildingSsa();
-  GlobalValueNumberer(&allocator, graph).Run();
+  {
+    SideEffectsAnalysis side_effects(graph);
+    side_effects.Run();
+    GlobalValueNumberer(&allocator, graph, side_effects).Run();
+  }
 
   // Check that all field get instructions are still there.
   ASSERT_EQ(field_get_in_loop_header->GetBlock(), loop_header);
@@ -195,7 +203,11 @@
 
   // Now remove the field set, and check that all field get instructions have been GVN'ed.
   loop_body->RemoveInstruction(field_set);
-  GlobalValueNumberer(&allocator, graph).Run();
+  {
+    SideEffectsAnalysis side_effects(graph);
+    side_effects.Run();
+    GlobalValueNumberer(&allocator, graph, side_effects).Run();
+  }
 
   ASSERT_TRUE(field_get_in_loop_header->GetBlock() == nullptr);
   ASSERT_TRUE(field_get_in_loop_body->GetBlock() == nullptr);
@@ -256,12 +268,12 @@
     entry->AddInstruction(new (&allocator) HInstanceFieldSet(
         parameter, parameter, Primitive::kPrimNot, MemberOffset(42), false));
 
-    GlobalValueNumberer gvn(&allocator, graph);
-    gvn.Run();
+    SideEffectsAnalysis side_effects(graph);
+    side_effects.Run();
 
-    ASSERT_TRUE(gvn.GetBlockEffects(entry).HasSideEffects());
-    ASSERT_FALSE(gvn.GetLoopEffects(outer_loop_header).HasSideEffects());
-    ASSERT_FALSE(gvn.GetLoopEffects(inner_loop_header).HasSideEffects());
+    ASSERT_TRUE(side_effects.GetBlockEffects(entry).HasSideEffects());
+    ASSERT_FALSE(side_effects.GetLoopEffects(outer_loop_header).HasSideEffects());
+    ASSERT_FALSE(side_effects.GetLoopEffects(inner_loop_header).HasSideEffects());
   }
 
   // Check that the side effects of the outer loop does not affect the inner loop.
@@ -271,13 +283,13 @@
             parameter, parameter, Primitive::kPrimNot, MemberOffset(42), false),
         outer_loop_body->GetLastInstruction());
 
-    GlobalValueNumberer gvn(&allocator, graph);
-    gvn.Run();
+    SideEffectsAnalysis side_effects(graph);
+    side_effects.Run();
 
-    ASSERT_TRUE(gvn.GetBlockEffects(entry).HasSideEffects());
-    ASSERT_TRUE(gvn.GetBlockEffects(outer_loop_body).HasSideEffects());
-    ASSERT_TRUE(gvn.GetLoopEffects(outer_loop_header).HasSideEffects());
-    ASSERT_FALSE(gvn.GetLoopEffects(inner_loop_header).HasSideEffects());
+    ASSERT_TRUE(side_effects.GetBlockEffects(entry).HasSideEffects());
+    ASSERT_TRUE(side_effects.GetBlockEffects(outer_loop_body).HasSideEffects());
+    ASSERT_TRUE(side_effects.GetLoopEffects(outer_loop_header).HasSideEffects());
+    ASSERT_FALSE(side_effects.GetLoopEffects(inner_loop_header).HasSideEffects());
   }
 
   // Check that the side effects of the inner loop affects the outer loop.
@@ -288,13 +300,13 @@
             parameter, parameter, Primitive::kPrimNot, MemberOffset(42), false),
         inner_loop_body->GetLastInstruction());
 
-    GlobalValueNumberer gvn(&allocator, graph);
-    gvn.Run();
+    SideEffectsAnalysis side_effects(graph);
+    side_effects.Run();
 
-    ASSERT_TRUE(gvn.GetBlockEffects(entry).HasSideEffects());
-    ASSERT_FALSE(gvn.GetBlockEffects(outer_loop_body).HasSideEffects());
-    ASSERT_TRUE(gvn.GetLoopEffects(outer_loop_header).HasSideEffects());
-    ASSERT_TRUE(gvn.GetLoopEffects(inner_loop_header).HasSideEffects());
+    ASSERT_TRUE(side_effects.GetBlockEffects(entry).HasSideEffects());
+    ASSERT_FALSE(side_effects.GetBlockEffects(outer_loop_body).HasSideEffects());
+    ASSERT_TRUE(side_effects.GetLoopEffects(outer_loop_header).HasSideEffects());
+    ASSERT_TRUE(side_effects.GetLoopEffects(inner_loop_header).HasSideEffects());
   }
 }
 }  // namespace art