Improved and simplified loop optimizations.

Rationale:
Empty preheader simplification has been simplified
to a much more general empty block removal optimization
step. Incremental updating of induction variable
analysis enables repeated elimination or simplification
of induction cycles.

This enabled an extra layer of optimization for
e.g. Benchpress Loop (17.5us. -> 0.24us. -> 0.08us).
So the original 73x speedup is now multiplied
by another 3x, for a total of about 218x.

Test: 618-checker-induction et al.
Change-Id: I394699981481cdd5357e0531bce88cd48bd32879
diff --git a/compiler/optimizing/loop_optimization.h b/compiler/optimizing/loop_optimization.h
index b2bf1c8..9c4b462 100644
--- a/compiler/optimizing/loop_optimization.h
+++ b/compiler/optimizing/loop_optimization.h
@@ -46,7 +46,7 @@
           inner(nullptr),
           previous(nullptr),
           next(nullptr) {}
-    const HLoopInformation* const loop_info;
+    HLoopInformation* const loop_info;
     LoopNode* outer;
     LoopNode* inner;
     LoopNode* previous;
@@ -61,9 +61,10 @@
   void TraverseLoopsInnerToOuter(LoopNode* node);
 
   void SimplifyInduction(LoopNode* node);
+  void SimplifyBlocks(LoopNode* node);
   void RemoveIfEmptyLoop(LoopNode* node);
 
-  bool IsOnlyUsedAfterLoop(const HLoopInformation& loop_info,
+  bool IsOnlyUsedAfterLoop(HLoopInformation* loop_info,
                            HInstruction* instruction,
                            /*out*/ int32_t* use_count);
   void ReplaceAllUses(HInstruction* instruction, HInstruction* replacement);
@@ -87,6 +88,11 @@
   // Contents reside in phase-local heap memory.
   ArenaSet<HInstruction*>* iset_;
 
+  // Counter that tracks how many induction cycles have been simplified. Useful
+  // to trigger incremental updates of induction variable analysis of outer loops
+  // when the induction of inner loops has changed.
+  int32_t induction_simplication_count_;
+
   friend class LoopOptimizationTest;
 
   DISALLOW_COPY_AND_ASSIGN(HLoopOptimization);