Ensure ClearLoopInformation doesn't require particular ordering

The ClearLoopInformation call used to use the RPO list to find
blocks which potentially had loop-information. This meant that if one
was also clearing the dominance information (which is quite common)
one needed to be sure to call ClearLoopInformation before calling
ClearDominanceInformation or else loop information will not be fully
cleared. This could cause quite perplexing errors if dominance
information is recomputed later (also quite common). This error is in
fact present in several tests (none of which use loops which is how it
got missed).

Fix this issue by just looping over all blocks. Also add a new
GetActiveBlocks function which does the filtering of null blocks
automatically. In many cases (such as these) we use RPO purely because
it doesn't require filtering. This should be able to replace these
uses.

Test: ./test.py --host
Change-Id: I60c7defc409111471064e9bf02b7ae3a0eb10584
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 1773c07..e3e4589 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -228,7 +228,7 @@
 }
 
 void HGraph::ClearDominanceInformation() {
-  for (HBasicBlock* block : GetReversePostOrder()) {
+  for (HBasicBlock* block : GetActiveBlocks()) {
     block->ClearDominanceInformation();
   }
   reverse_post_order_.clear();
@@ -236,7 +236,7 @@
 
 void HGraph::ClearLoopInformation() {
   SetHasIrreducibleLoops(false);
-  for (HBasicBlock* block : GetReversePostOrder()) {
+  for (HBasicBlock* block : GetActiveBlocks()) {
     block->SetLoopInformation(nullptr);
   }
 }
@@ -1694,11 +1694,8 @@
 #undef DEFINE_ACCEPT
 
 void HGraphVisitor::VisitInsertionOrder() {
-  const ArenaVector<HBasicBlock*>& blocks = graph_->GetBlocks();
-  for (HBasicBlock* block : blocks) {
-    if (block != nullptr) {
-      VisitBasicBlock(block);
-    }
+  for (HBasicBlock* block : graph_->GetActiveBlocks()) {
+    VisitBasicBlock(block);
   }
 }