Stmt visitors and walkers.

- Update InnermostLoopGatherer to use a post order traversal (linear
  time/single traversal).
- Drop getNumNestedLoops().
- Update isInnermost() to use the StmtWalker.

When using return values in conjunction with walkers, the StmtWalker CRTP
pattern doesn't appear to be of any use. It just requires overriding nearly all
of the methods, which is what InnermostLoopGatherer currently does. Please see
FIXME/ENLIGHTENME comments. TODO: figure this out from this CL discussion.

Note
- Comments on visitor/walker base class are out of date; will update when this
  CL is finalized.

PiperOrigin-RevId: 206340901
diff --git a/lib/IR/AsmPrinter.cpp b/lib/IR/AsmPrinter.cpp
index 90115ec..e53962e 100644
--- a/lib/IR/AsmPrinter.cpp
+++ b/lib/IR/AsmPrinter.cpp
@@ -846,7 +846,7 @@
 /// Number all of the SSA values in this ML function.
 void MLFunctionPrinter::numberValues() {
   // Visits all operation statements and numbers the first result.
-  struct NumberValuesPass : public StmtVisitor<NumberValuesPass> {
+  struct NumberValuesPass : public StmtWalker<NumberValuesPass> {
     NumberValuesPass(MLFunctionPrinter *printer) : printer(printer) {}
     void visitOperationStmt(OperationStmt *stmt) {
       if (stmt->getNumResults() != 0)
@@ -857,7 +857,7 @@
 
   NumberValuesPass pass(this);
   // TODO: it'd be cleaner to have constant visitor istead of using const_cast.
-  pass.visit(const_cast<MLFunction *>(function));
+  pass.walk(const_cast<MLFunction *>(function));
 }
 
 void MLFunctionPrinter::print() {