Reduce time and memory usage of GVN.

Filter out dead sregs in GVN. Reclaim memory after each LVN
in the GVN modification phase.

Bug: 16398693
Change-Id: I8c88c3009663754e1b66c0ef3f62c3b93276e385
diff --git a/compiler/dex/global_value_numbering.h b/compiler/dex/global_value_numbering.h
index a12a779..c06ff6f 100644
--- a/compiler/dex/global_value_numbering.h
+++ b/compiler/dex/global_value_numbering.h
@@ -32,7 +32,8 @@
   ~GlobalValueNumbering();
 
   // Prepare LVN for the basic block.
-  LocalValueNumbering* PrepareBasicBlock(BasicBlock* bb);
+  LocalValueNumbering* PrepareBasicBlock(BasicBlock* bb,
+                                         ScopedArenaAllocator* allocator = nullptr);
 
   // Finish processing the basic block.
   bool FinishBasicBlock(BasicBlock* bb);
@@ -55,7 +56,7 @@
 
   // GlobalValueNumbering should be allocated on the ArenaStack (or the native stack).
   static void* operator new(size_t size, ScopedArenaAllocator* allocator) {
-    return allocator->Alloc(sizeof(GlobalValueNumbering), kArenaAllocMIR);
+    return allocator->Alloc(sizeof(GlobalValueNumbering), kArenaAllocMisc);
   }
 
   // Allow delete-expression to destroy a GlobalValueNumbering object without deallocation.