Skip loop optimization if there is no loop in the graph.

LinearizeGraph() does quite some allocations.
Also add some comments on the possible false positives of
some flags.

Test: m test-art-host
Change-Id: I80ef89a2dc031d601e7621d0b22060cd8c17fae3
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 71a26eb..62c8910 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -688,6 +688,7 @@
     contains_irreducible_loop_ = true;
     graph->SetHasIrreducibleLoops(true);
   }
+  graph->SetHasLoops(true);
 }
 
 HBasicBlock* HLoopInformation::GetPreHeader() const {
@@ -2032,9 +2033,19 @@
     }
   }
   outer_graph->UpdateMaximumNumberOfOutVRegs(GetMaximumNumberOfOutVRegs());
+
   if (HasBoundsChecks()) {
     outer_graph->SetHasBoundsChecks(true);
   }
+  if (HasLoops()) {
+    outer_graph->SetHasLoops(true);
+  }
+  if (HasIrreducibleLoops()) {
+    outer_graph->SetHasIrreducibleLoops(true);
+  }
+  if (HasTryCatch()) {
+    outer_graph->SetHasTryCatch(true);
+  }
 
   HInstruction* return_value = nullptr;
   if (GetBlocks().size() == 3) {